If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Problem with select in a select

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-04, 15:17
tde tde is offline
Registered User
 
Join Date: Nov 2004
Posts: 1
Problem with select in a select

SELECT * from table1, table2 where table1.field1 > 20031126 and table1.field2 in (select field3 from table2 where field4=5)

is this possible ???

Last edited by tde; 11-26-04 at 15:38.
Reply With Quote
  #2 (permalink)  
Old 11-26-04, 15:31
Richardwhiuk Richardwhiuk is offline
Registered User
 
Join Date: Nov 2004
Posts: 9
1) I am not sure whether mySQL supports subquerys.
2) I don't get what you are trying to do? Should there be something between 20031126 and table1.field2
Reply With Quote
  #3 (permalink)  
Old 11-26-04, 16:33
beilstwh beilstwh is offline
Lead Application Develope
 
Join Date: Jun 2004
Location: Liverpool, NY USA
Posts: 2,222
Quote:
Originally Posted by tde
SELECT * from table1, table2 where table1.field1 > 20031126 and table1.field2 in (select field3 from table2 where field4=5)

is this possible ???
Even if it does allow sub-queries, your query will produce a cartesian join. You have not joined table1 and table2 in your main query. You might want to rewrite it as.

select table1.*.table2.*
from table1,table2
where table2.field4 = 4
and table1.field2 = table2.field3;
__________________
Bill
You do not need a parachute to skydive. You only need a parachute to skydive twice.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On