Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
aminsam
Starting Member
6 Posts |
Posted - 2004-05-19 : 01:51:47
|
| My table have multiple record in same Date filedWhen i use Distinct for return only one instance of every date, it return all records with same date ;------------------------------------------------SELECT DISTINCT date, name,number,IDFROM new_tableORDER BY number------------------------------------------------2004/04/02 07:16:02 P.M , james, 0033134545,1525462004/03/20 04:44:08 P.M , marc , 0048182569,1525482004/03/20 04:44:08 P.M , marc , 0049285596,1525892004/03/20 04:44:08 P.M , marc , 0081254782,168958--------------------------------------------------record 2 , 3, 4 have same date yet |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-05-19 : 03:59:24
|
| DISTINCT works on a row not on an individual column. What sort of output do you want? If you want it to return only two rows, then what data do you want returned for the second row from the name, number and ID columns?OS |
 |
|
|
aminsam
Starting Member
6 Posts |
Posted - 2004-05-19 : 04:13:31
|
| I found the answerDISTINCT operates on all the columns selected in the query togetherThanks |
 |
|
|
|
|
|
|
|