Page 1 of 1

SQL QUEry

Posted: Mon Jan 10, 2011 1:57 pm
by webdzine
hey is there a way to tell a query

"SELECT * from ...

but to ignore id x and y?

Re: SQL QUEry

Posted: Mon Jan 10, 2011 2:04 pm
by AbraCadaver
No. You either tell it to get all (*) or specify what you want: a, b, c, etc...

Re: SQL QUEry

Posted: Mon Jan 10, 2011 2:22 pm
by mikosiko
webdzine wrote:is there a way to tell a query

"SELECT * from ...

but to ignore id x and y?
another way to read and answer your question ... if your table has several columns and one of them is named "id" and you want to exclude the rows where "id" is either "x" or "y" then the answer is yes... you can exclude them in this way:

Code: Select all

SELECT * FROM <your_table>
WHERE id NOT IN ('x', 'y')

Re: SQL QUEry

Posted: Mon Jan 10, 2011 2:57 pm
by AbraCadaver
Ahh yes, I now see another way to interpret the question :)