HELP with SELECTING record FROM MySQL
Posted: Sat Jan 17, 2009 1:32 am
Hello Everyone,
I would like you to assist me in solving this problem I am having extracting data from MYSQL with PHP.
I have a table in my database as seen below, I am attempting to select all the Client_id that are associated with the Project_id of '20'.
ID | Client_id | Project_id
1 | 1007 | 20
2 | 1009 | 20
3 | 1010 | 16
4 | 1007 | 20
5 | 1007 | 15
6 | 1007 | 20
7 | 1009 | 16
8 | 1007 | 20
9 | 1010 | 20
10 | 1007 | 16
I have written a select statement that looped through and extract the Client_id that relates to Project 20 with the following results: (SELECT Client_id FROM Table WHERE Project_id = 20)
1007
1009
1007
1007
1007
1010
However, I would like each Client_id that associates with '20' to only be outputted once instead of everytime they appeared , for example:
1007
1009
1010
Kindly assist me since I have been at this for more than a week.
Thanks
Dave
I would like you to assist me in solving this problem I am having extracting data from MYSQL with PHP.
I have a table in my database as seen below, I am attempting to select all the Client_id that are associated with the Project_id of '20'.
ID | Client_id | Project_id
1 | 1007 | 20
2 | 1009 | 20
3 | 1010 | 16
4 | 1007 | 20
5 | 1007 | 15
6 | 1007 | 20
7 | 1009 | 16
8 | 1007 | 20
9 | 1010 | 20
10 | 1007 | 16
I have written a select statement that looped through and extract the Client_id that relates to Project 20 with the following results: (SELECT Client_id FROM Table WHERE Project_id = 20)
1007
1009
1007
1007
1007
1010
However, I would like each Client_id that associates with '20' to only be outputted once instead of everytime they appeared , for example:
1007
1009
1010
Kindly assist me since I have been at this for more than a week.
Thanks
Dave