davestewart Posted January 21, 2008 Share Posted January 21, 2008 Hi there, I've not come across this before, but is it possible to narrow a wildcard selection (as you can for example with regexp or file systems) such as these examples: SELECT contact* FROM users SELECT q* FROM survey rather than SELECT contact_email_1, contact_email_2, contact_address FROM users SELECT q1, q2, q3, q4, q5, q6 FROM survey Many thanks, Dave Quote Link to comment https://forums.phpfreaks.com/topic/87052-wildcards-narrowing-a-select-query/ Share on other sites More sharing options...
GingerRobot Posted January 21, 2008 Share Posted January 21, 2008 Not that i'm aware of. While mysql does have support for regular expressions and wildcards, they can, as far as i know, only be used in the context of the WHERE clause. I would also be questioning your database structure if you have 6 fields named q1-q6. Perhaps its necessary, but it sounds like you need to take a look at database normalization. Quote Link to comment https://forums.phpfreaks.com/topic/87052-wildcards-narrowing-a-select-query/#findComment-445201 Share on other sites More sharing options...
davestewart Posted January 21, 2008 Author Share Posted January 21, 2008 Hi Ginger, Thanks for the reply. Yes, I know what you mean about the field names. In this case, it's OK, but I get that an 2-column intermediate table would in the main part be a better option. It's a tiny site, and a fixed survey, so not worth the extra work in this case Quote Link to comment https://forums.phpfreaks.com/topic/87052-wildcards-narrowing-a-select-query/#findComment-445292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.