RE: [PHP] URGENT - Help in mySql query

From: Date: Thu, 18 Oct 2001 02:34:21 +0000
Subject: RE: [PHP] URGENT - Help in mySql query
Groups: php.general 
Request: Send a blank email to php-general+get-71435@lists.php.net to get a copy of this message
Pretty simple really: SELECT * FROM newsletter, newsletterArticle WHERE newsletter.ID = newsletterArticle.refID; ... will only pull out data when the condition is satisfied. Jason -- Jason Murray jasonm@melbourneit.com.au Web Developer, Melbourne IT "Work now, freak later!" > -----Original Message----- > From: Manisha [mailto:manisha@aurica.com] > Sent: Thursday, October 18, 2001 12:29 PM > To: php-general@lists.php.net > Subject: [PHP] URGENT - Help in mySql query > > > hi, > > I want to write one query. I have 2 tables one as a master > and another as > detail. > > 1) newsletter - master table - ID and title is stored > 2) newsletterArticle - details table - artID, refID (ref of > master table) > and body text is stored. > > I want to display the newsletter only if I found > corresponding record in > newsletterArticle. > > i.e if in newsletter there is an entry for ID 1, but no article in > newsletterArticle, then I do not want to display that record. > > This I want to achieve in single query. Something like below > > select ID from newsletter where (select count(*) from > newsletterArticle > where refID = the ID of newsletter ???? > 0) > > Platform - PHP / mySql /BSDi > > > Any help ? It is very urgent > > manisha > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.general (#71435) next »