Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select all except some rows

Tags:

sql

let's say i have table with this structure:

  id      model       color
------  --------    ----------
   1      Ford           yellow
   2      Ford           green
   3      Ford           red
   4      Ford           yellow
   5      Subaru         yellow
   6      Subaru         red

I need to make a query, which returns me every car in list, except for yellow ford's. Can somebody help?

like image 592
nukl Avatar asked Aug 26 '11 00:08

nukl


1 Answers

... WHERE NOT (model = 'Ford' AND color = 'yellow')
like image 161
Foo Bah Avatar answered Oct 17 '22 02:10

Foo Bah