Hello Tarik,
The DISTINCT option will sort this out for you.
=dn

> I got two tables containing following data :
>
> table1
> ------
> id
> --
> 2
> 3
> 2
> 2
>
> table2
> ----------
> id | label
> ----------
> 1  | one
> 2  | two
> 3  | three
> 4  | four
>
> I would like to select table2's rows that got at less one occurrence in
> table1, ie (2, two) and (3, three).
>
> That I tried was the following query:
>
> SELECT table2.* FROM table2, table1 WHERE table2.id=table1.id
>
> But this would give me an answer for each value of table1: two times (3,
> three) and three times (2, two), while I just want them on time...
>
> Thank you,
> Tarik
>
>
> ---------------------------------------------------------------------
> 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

Reply via email to