The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

mySQL Query query - excuse the pun

I was wondering if it is possible to SELECT (*) everything (BUT) with a MySQL QUERY? I have a large number of fields I want to SELECT FROM an table and I want them all but '1'. As its only 1 field I don't want it seems really annoying that I have to select every field I want individually and ommit the one I don't want.

no, not that i know of. is this through PHP or something, or the command line? if it's PHP, i wouldn't worry about it. it's actually faster to do SELECT * rather than naming all the columns if you're selecting (almost) all of them. now, if it's on the command line and you don't want to see the column, i can understand.

- Matt ** Ignore old signature for now... **
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3." "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

I think I have found a solution - the SELECT I need this for is for a 2 table join where both tables have column name id. I realised that SELECT * was much faster than SELECT field1, field2, field3 etc..... So I wanted to use * for both speed and simplicity - but then had the problem of having 2 'id' fields returned (I don't want and didn't need the id from the second table as I already had the value as table2_id held in table1 - this was used to join the 2 tables).

So I did a bit of research and came up with the following (which works) : -

If the only field you don't want to select is a large text or a BLOB, then I don't think SELECT * is going to be faster because it takes time (and memory) to move data. I'd suggest being very careful with using SELECT *.