Re: wild cards for table names in a MySQL select statement

From: Date: Sat, 18 Nov 2000 00:13:12 +0000
Subject: Re: wild cards for table names in a MySQL select statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4526@lists.php.net to get a copy of this message
No way to do that with standard SQL that I'm aware of, Michael. But if you have 47 columns with similar names and another 47 columns with similar names, it sounds like you might want to think about normalizing the schema a bit. If you've already de-normalized for performance reasons, make sure it is worth it. You don't want to lose functionality that you might need later; and make sure that the speed advantage outweighs the disadvantage of losing the functionality that you do lose. Doug At 03:35 PM 11/17/00 -0600, Michael Hall wrote: >This question is born of sheer laziness, but an answer may be lurking out >there. > >We have a MySQL table that lists prices. There are 47 columns that begin >with "WS" (for wholesale prices), and 47 corresponding columns that begin >with "RT" (for retail prices). > >What we would like to do to avoid writing them all out everyplace, is to >select all fields starting with "WS" or all fields starting with "RT". > >It's not a big deal, but it would be quite convenient if we could use some >sort of wild card in the SELECT statement. > >We've tried "SELECT lsp_size_price.WS%" and "SELECT lsp_size_price.WS*" >(two >logical choices) but they only give us syntax errors. > >If anyone could help us out, it would be appreciated. > >Michael Hall >Database Engineer >Prairie Fire Web Design >mike@prairiefirewebdesign.com >

« previous php.db (#4526) next »