Re: retriving values from two tables

From: Date: Tue, 19 Nov 2002 17:32:02 +0000
Subject: Re: retriving values from two tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-23486@lists.php.net to get a copy of this message
> Hi all, > > I am karthik. I am using using php with mysql. i am stuck with a qury. Pls hep me out. > > i have two tables. Here is table with sample data > > Table Name : Links > > linkid header > 1 yahoo.com > 2 google.com > 3 php.net > 4 sai.org > 5 mysql.net > > Table Name : subLinks > > linkid childid > 1 2 > 3 5 > 4 3 > > I want to fetch the linkid and header from links table based on condition that i select only the main links. which are not under any link > > In our example it is > > 1 and 4 > > Pls help out with the query..Its Urgent > > Thanks > > Jai Sairam > > Karthikeyan.S How about: SELECT l.linkid, l.header FROM Links l LEFT JOIN subLinks s ON l.linkid = s.childid WHERE s.childid IS NULL I think that'll work. ---John Holmes...

« previous php.db (#23486) next »