Problem with query...

Problem with query...

am 29.12.2005 22:42:49 von Leszek

Hi
I have a database that has some repeatnig variables in the same column...
Is it possible to return rows from this column one by one, but avoiding
repeating variables? How such a query should look like? (I think about while
loop in php)

I need this to make dropdown list.

Thanks
Leszek

Re: Problem with query...

am 29.12.2005 23:25:42 von Stefan Rybacki

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

Leszek wrote:
> Hi
> I have a database that has some repeatnig variables in the same column...
> Is it possible to return rows from this column one by one, but avoiding
> repeating variables? How such a query should look like? (I think about while
> loop in php)
>

You may look for SQL keywords like DISTINCT or GROUP BY.

Regards
Stefan

> I need this to make dropdown list.
>
> Thanks
> Leszek
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1rc2 (MingW32)

iD8DBQFDtGJmyeCLzp/JKjARApcNAJ4xkgy3gygtXjzNEkvX5S0IgFTASACg iMeP
MjmHKUOjPqorP+XNkoMMhEc=
=Ubfo
-----END PGP SIGNATURE-----

Re: Problem with query...

am 30.12.2005 12:38:25 von Ramya

If the table has a column named "age" with repeated values, then

SELECT distict age FROM



IF you need to include any condition, use as below.

SELECT distinct age FROM
WHERE

Re: Problem with query...

am 30.12.2005 12:40:10 von Ramya

If you have a table with column named "age" and it has repeated values.

SELECT DISTINCT age FROM



Else if you need to use any condition while fetching data,
then use the below query

SELECT DISTINCT age FROM
WHERE

Re: Problem with query...

am 30.12.2005 12:41:26 von Ramya

SELECT distict age FROM


sorry
the above query should be

SELECT distinct age FROM