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 |
|
danielc
Starting Member
49 Posts |
Posted - 2010-04-12 : 01:39:53
|
| How would I find all records with the same date? The table has 3 columns id, date, and playid. The data is as follows:ID date playid1 2004-10-01 452 2004-10-05 563 2004-10-05 534 2006-01-09 135 2007-03-04 89Thank you,C |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-04-12 : 01:43:52
|
| Whats your expected output?Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-12 : 01:45:36
|
find record that have more than 1 record with same date ?select datefrom yourtablegroup by datehaving count(*) > 1 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-12 : 06:08:47
|
quote: Originally posted by danielc How would I find all records with the same date? The table has 3 columns id, date, and playid. The data is as follows:ID date playid1 2004-10-01 452 2004-10-05 563 2004-10-05 534 2006-01-09 135 2007-03-04 89Thank you,C
SELECT t.*FROM Table tINNER JOIN (select datefrom yourtablegroup by datehaving count(*) > 1)t1ON t1.date = t.date ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
danielc
Starting Member
49 Posts |
Posted - 2010-04-12 : 12:25:06
|
| Thank you for the replies. To answer one of the questions, my expected results would be:ID date playid2 2004-10-05 563 2004-10-05 53Thank you,C |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-12 : 13:05:31
|
quote: Originally posted by danielc Thank you for the replies. To answer one of the questions, my expected results would be:ID date playid2 2004-10-05 563 2004-10-05 53Thank you,C
my suggestion would give you this output------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|