R: [PHP] MySQL Question

From: Date: Mon, 31 Jul 2000 12:54:50 +0000
Subject: R: [PHP] MySQL Question
Groups: php.general 
Request: Send a blank email to php-general+get-9151@lists.php.net to get a copy of this message
if you need only columns from table "author", do: "SELECT au.* FROM author au WHERE EXISTS (SELECT 1 FROM article ar WHERE au.ID_author=ar.ID_article)". It's a little fast than a join (SELECT au.* FROM article ar,author au WHERE au.ID_author=ar.ID_article) P.S.: whenever you posted this message in wrong list, for useful answers you'd better always do complete and clear questions. Could you describe that tables a little? You know, but whom you ask what could know about your business? If you call all tables' primary keys "id", how to do a well-explain of what you need? Ciao Roberto > -----Messaggio originale----- > Da: Simon Biela [mailto:mail2fax@netdienste.de] > Inviato: lunedì 31 luglio 2000 2.17 > A: php-general@lists.php.net > Oggetto: [PHP] MySQL Question > > > Hi there! > > I am sorry posting this message in a PHP list, but I didn't > find any mysql > or sql newsgroup. > > I have two tables in my database. Lets call the one "article" > and the other > "author". In the table article is a field called author, > which only includes > the id of the articles author. To get the article and author > information I > gotta do the following > > SELECT * FROM article WHERE id LIKE '1' > > and then > > SELECT * FROM author WHERE id LIKE '123' <--- the id from the > other query > > Is there any possibility doing this in just one SQL Query? > > Thanks. > Simon > > --- > netdienste GbR > internet & multimedia > Geisselstrasse 19 > 50823 Koeln > > tel: +49 221 - 932 958 2 > fax: +49 221 - 932 958 5 > > s.biela@netdienste.de > http://www.netdienste.de > > red:pepper - das redaktionssystem > www.redpepper.netdienste.de > > > > > > -- > 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 (#9151) next »