Forum Moderators: open

Message Too Old, No Replies

Select * Except .

Does this syntax work?

         

ahmedtheking

6:00 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there some SQL syntax where by you can select all the fields apart from ones you specify?

stajer

8:18 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



SELECT * FROM table WHERE table_id NOT IN (comma separate list of table_id's)

stajer

8:20 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



Ah, unless you mean columns - you want to select all columns except these ones you enumerate. Then, no, there is no such syntax.

But, you could do several queries.

SELECT * FROM table WHERE table_ID = 0 will get you an empty query result set with just the column headers. Use your favorite programming language to to put the column headings into a list, strip out the column headings you don't want, then put that list into the select statement for the real query.

ahmedtheking

12:41 am on Jan 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm lame. In the end I guess I've got to use PHP to separate the columns!