Jump to content

Wildcards / Narrowing a SELECT query


davestewart

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
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.

Link to comment
Share on other sites

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.