Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    Unanswered: 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 16:38.

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

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •