-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Mercredi 9 Juillet 2003 15:13, phpu a écrit :
> I have a table like this:

> ......
> $sql = "SELECT * FROM products, category WHERE
> category.name_category=products.name_category and
> category_id=".$_GET['category_id'] ;

>
> When i choose the category catg 1 the result is
> Name: aaa
> Name: aaa
> Name: ddd
>
> As you can see the name aaa appears 2 times insted 1.
> How to make the result look like this:
> Name: aaa
> Name: ddd

Use "GROUP BY" ....

$sql = "SELECT * FROM products, category WHERE 
category.name_category=products.name_category and 
category_id=".$_GET['category_id'] GROUP BY products.mark_name;


- -- 
   ,,
  (°>   Nicolas Costes
  /|\   IUT de La Roche / Yon
 ( ^ )  Clé publique: http://www.keyserver.net/
  ^ ^   http://www.gnu.org/philosophy/can-you-trust.fr.html


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/DB2GNc2aXy7LuOgRAmE6AKCIeGpWg78san/72M7vbhwJXQKXbQCfVxAJ
OgayWbAh0cOXc5OCdVy2uWs=
=vH6U
-----END PGP SIGNATURE-----


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to