MySQL Forums
Forum List  »  Newbie

Re: Problem with select using several tables
Posted by: Mikko
Date: August 24, 2004 03:44AM

Harsha Chaithanya K wrote:
> try using joins.
>
> select * from table1 t1
> left join table2 t2 on t1.id = t2.rel
> where t2.rel = somevalue
> and t1.active = 1
>
> Hope this helps you.

Thanks for your suggestion, I forgot to mention that I tried it too but now I think I know why it fails anyway after I tried your left join clause and actually saw the results... (that somevalue record is active, when in fact I need to know that it is active AND also table2 records are active so I was missing the last part - sounds like a wrond db design maybe to have this kind of 1 to 1 relationship in some cases).

I'll try next if I can figure this out myself ;o)

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with select using several tables
August 24, 2004 03:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.