SQL QUEry

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
webdzine
Forum Newbie
Posts: 20
Joined: Wed Dec 08, 2010 12:40 am

SQL QUEry

Post by webdzine »

hey is there a way to tell a query

"SELECT * from ...

but to ignore id x and y?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: SQL QUEry

Post by AbraCadaver »

No. You either tell it to get all (*) or specify what you want: a, b, c, etc...
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: SQL QUEry

Post 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')
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: SQL QUEry

Post by AbraCadaver »

Ahh yes, I now see another way to interpret the question :)
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply