Dear Jamie,

try a JOIN (LEFT JOIN I would suppose for your problem). Read the MySQL
manual chapter 7 (look for the join syntax there). It is something like

    SELECT * FROM table1 LEFT JOIN table2 ON (table1.id = table2.id)

Regards,

Stefan Hinz (Geschäftsleitung)
iConnect e-commerce solutions GmbH
www.iConnect.de - www.js-webShop.de
TEL +49 30 46307-382 - FAX -388
 ---
----- Original Message -----
From: Jamie Burns <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 05, 2001 11:25 PM
Subject: quickie!


hi..

can someone tell me how i get the data from two tables, where table1
will have one row, and table2 will have many rows?

eg:

================================

table1:

    id    name

    1    barney
    2    fred
    3    wilma

table2:

    id    student_id     subject

    1    1                   english
    1    1                   cookery
    1    1                   maths
    1    1                   science
    1    2                   woodwork
    1    3                   cookery

================================

do i have to use two queries to get all this data out in usable form?

thanks,

jamie.






---------------------------------------------------------------------
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

Reply via email to