|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Distint Mysql
I was wondeirng if there is someway to do this. For example if i have a sql table that looks like this
NAME ADDRESS JACK 1234 Street JOE 2345 Street JAMES 2349 Street JOE 3459 Street Is there a way to use the SELECT mysql query to show only the first JOE in my results and not the second along with the other names. Like I want it to show this when I use the SELECT QUERY: NAME ADDRESS JACK 1234 Street JOE 2345 Street JAMES 2349 Street Please help. Thank you ![]() |
|
#2
|
||||
|
||||
|
Try this:
SELECT DISTINCT name, address FROM table; |
|
#3
|
|||
|
|||
|
That wouldn't work because your statements is
SELECT DISTINCT name, address FROM table; and since it tells MYSQL to select only the distinct name & address it'll still display all of them because no two are the same address and name. I only want it to show distinct base on name only not with address too. |
|
#4
|
|||
|
|||
|
*bump*
any help plz.... i really need this |
|
#5
|
||||
|
||||
|
Mabye SELECT DISTINCT(name), address FROM table?
|
|
#6
|
|||
|
|||
|
it didn't work
neone else know how? |
|
#7
|
||||
|
||||
|
what's the error you're getting?
have you tried simply doing SELECT DISTINCT name FROM table; then working up from there? I trust you're replacing the word "table" with your tablename... (i noticed your post said table... just want to make sure) |
|
#8
|
|||
|
|||
|
i'm not getting an error, yes i have been replacing the word table of course. The error is that it's not displaying what I need.
In the MYSQL database it has this info: NAME ADDRESS JACK 1234 Street JOE 2345 Street JAMES 2349 Street JOE 3459 Street However, I would like it to show NAME ADDRESS JACK 1234 Street JOE 2345 Street JAMES 2349 Street Using SELECT DISTINCT name, address FROM table; would still display all 5 of the points from the MySQL table. I only want to show the distinct names, not the distinct names and addresses. And refering to your comment of "have you tried simply doing SELECT DISTINCT name FROM table; then working up from there?", how would I work up from there, since that only displays the name and not the address. |
|
#9
|
||||
|
||||
|
Sorry to underestimate your knowledge... just had to make sure we were on the same page =)
I feel I fully understand your question... Its starting to bug me. I'm gonna help figure it out... |
|
#10
|
||||
|
||||
|
No point getting snippy with the people who are trying to help you, uff8site.
Try a group by: Code:
SELECT name, address FROM table GROUP BY name This worked in a db I set up to test it. |
|
#11
|
|||
|
|||
|
sorry... if my comment sounded repulsive in some way.... I just wanted to get my point across.
BTW, Thanks that worked ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Distint Mysql |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|