Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2004-07-06, 05:52 PM
Dawuad
Guest
 
Posts: n/a
Default

I can not find out the answer how to search for something like the following:
SELECT FROM Table where COLUMN IN (a, B).

What I want is to select from the table where Column is a subset of a AND b. Since the IN clause says column = a or column = b, I want column = a also column needs to b. The problem with using regular AND statements is that the COLUMN can have multiple fields.

Example imagine a List with (a, b, c, d, e) and the data is populated with rows like 1a, b, d), 2: (a, c, d)

So if query the following SELECT FROM Table WHERE column = a and column =b. I should get back only "1" record and not "2" record. I don't get back anything. Because 1 = a and b and d.

How do I execute this type of query
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2004-07-06, 06:53 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

I would just use regular and/or statements for this one. Espeically since MySQL does not support subselects from results.

I could give an example but I would like to see a dump of your table and what you are trying to get without the generic stuff since there appear to be some confused terms that are really making it hard for me to understand what you are after.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #3 (permalink)  
Old 2004-07-07, 04:00 AM
Moderator
 
Join Date: May 2004
Location: Portugal
Posts: 143
gesf is an unknown quantity at this point
Send a message via ICQ to gesf Send a message via MSN to gesf Send a message via Skype™ to gesf
Default

Hey Dawuad,
Not sure about what you want to do, but... take a look at this link, it may help you!

Cheers
__________________
Best Regards,
Gonçalo "GesF" Fontoura

Website : gesf.org
Reply With Quote
  #4 (permalink)  
Old 2004-07-07, 10:29 AM
Dawuad
Guest
 
Posts: n/a
Default

Xnuiem, what do you mean by that? Thanks for you help gesf, but I am looking for subselects like Xnuiem suggested.
Reply With Quote
  #5 (permalink)  
Old 2004-07-07, 01:32 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

The catch is that MySQL doesnt support subselects like Oracle or some of the larger SQL databases. It is supposed to in an upcoming version.

If you can, can you post your table(s) and data so I can run them into a database and figure out a solution for ya. I think I know what you are after, but I personally work better with examples.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:21 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.