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 |
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2009-09-10 : 14:52:44
|
| Hi.I need to get the first record when there is a duplication on my product_name field.for instance:PRODUCT_ID PRODUCT_NAME1111 Magazine Pack1112 Magazine Pack1144 Novels...the result should be:1111 Magazine Pack1144 Novels...I'we wrote this query:SELECT MIN(product_name) AS keywordFROM tbl_adword_keywordGROUP BY product_nameHAVING (COUNT(product_name) > 0)order by product_namewhich is good but I need to have the PRODUCT_ID's also,but when I'added the Product_id field It didn't give me the result.Plz help me.Thanks in advanced |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 14:55:15
|
SELECT MIN(product_id), product_name AS keywordFROM tbl_adword_keywordGROUP BY product_nameHAVING (COUNT(product_name) > 0)order by product_name No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2009-09-10 : 15:08:42
|
| thanks :) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 15:13:37
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|