Re: Big problem....need help
| From: | Nicolas Costes | Date: | Wed, 09 Jul 2003 13:49:50 +0000 |
| Subject: | Re: Big problem....need help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154546@lists.php.net to get a copy of this message | ||
-----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-----