Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/87052-wildcards-narrowing-a-select-query/
Share on other sites

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.

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

:)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.