Re: Whats the Query
| From: | Cody Caughlan | Date: | Mon, 06 Nov 2000 06:11:04 +0000 |
| Subject: | Re: Whats the Query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4227@lists.php.net to get a copy of this message | ||
I am unclear on what you are trying to do:
1) get all topics in table 3? if so,
then :
> select topic from table3;
would work
2) if you want to do a join on tables 1, 2 and 3 where your name in table1
has a certain nip which is in table 2 and the class corresponding to that
nip in table 2 is associated with a topic in table 3 and you want that topic
then something along the lines of:
> select t3.topic from table1 as t1, table2 as t2, table3 as t3 where t1.nip
= t2.nip and t2.class = t3.class and t1.name = 'Leonard';
would work, or a variation thereof, but thats the idea.
Good luck
/Cody Caughlan
Leonard Tambunan wrote:
> Hi All
>
> This is not bout php. :-))
> This is about SQL.
>
> I have three tables,
>
> Table1: Table2: Table3:
> -------- ---------- ---------
> nip nip class
> name class topic
>
> I am a teacher with name='Leonard' ( in table1).
> I wan to query all the topics (table3.topic) I have.
> What is the statement?
>
> I do need a help,
>
> Regards,
> Leonard Tambunan
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net