you will have to join the table with itself and reference it as if it is two tables. this might be slow however so you might want to make some specific indexes to speed it up.
This Query will return all the people who are engaged and a picture of their fiancé: select p1.lname, p1.fname, p1.pic, p2.pic from people p1, people p2 where p1.id = p2.engagedto; this query will return people whether they are engaged or not: select p1.lname, p1.fname, p1.pic, p2.pic from people p1 left join people p2 on (p1.id = p2.engagedto); -----Original Message----- From: Dean Householder [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 12:22 PM To: [EMAIL PROTECTED] Subject: basic query question I'm fairly new to MySQL, so if anyone could help me I'd really appreciate it! What I'm trying to do is join two pictures in a database to each other. My database holds info about people with variables: id, lname, fname, engagedto, pic The engagedto field contains the id of the person they are engaged to. I'm trying to print the people that are engaged to each other next to each other. I've played with the join command and a little with group but don't really understand how these work... If anyone could point me in the right direction regarding how to query the database to return these records connected to each other, I would really appreciate it! Thanks so much Dean --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php