Click here to Skip to main content
15,907,281 members
Home / Discussions / Database
   

Database

 
AnswerRe: Select records using distinct and order by [modified] Pin
Blue_Boy27-May-10 4:34
Blue_Boy27-May-10 4:34 
SELECT  DISTINCT TOP 2 <br />
<br />
	p.CategoryId,<br />
	(SELECT TOP 1 p2.AddDate<br />
	   FROM products p2 WHERE p2.CategoryId = p. CategoryId) AS adddate<br />
	<br />
FROM<br />
	products p<br />
ORDER BY p.CategoryId<br />


Hope this will help you.

I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.

www.aktualiteti.com
modified on Thursday, May 27, 2010 10:45 AM

GeneralRe: Select records using distinct and order by Pin
popchecker27-May-10 5:46
popchecker27-May-10 5:46 
AnswerRe: Select records using distinct and order by Pin
Eddy Vluggen27-May-10 6:27
professionalEddy Vluggen27-May-10 6:27 
GeneralRe: Select records using distinct and order by Pin
i.j.russell27-May-10 9:45
i.j.russell27-May-10 9:45 
GeneralRe: Select records using distinct and order by [modified] Pin
Tripathi Swati27-May-10 19:39
Tripathi Swati27-May-10 19:39 
GeneralRe: Select records using distinct and order by Pin
Mycroft Holmes27-May-10 21:53
professionalMycroft Holmes27-May-10 21:53 
GeneralRe: Select records using distinct and order by Pin
Eddy Vluggen28-May-10 1:40
professionalEddy Vluggen28-May-10 1:40 
QuestionMS SQL Connection Failed eg: "Trusted Connection"... Pin
PDTUM26-May-10 19:08
PDTUM26-May-10 19:08 
AnswerRe: MS SQL Connection Failed eg: "Trusted Connection"... Pin
_Damian S_26-May-10 19:23
professional_Damian S_26-May-10 19:23 
AnswerRe: MS SQL Connection Failed eg: "Trusted Connection"... Pin
PDTUM27-May-10 5:10
PDTUM27-May-10 5:10 
QuestionExporting only Defination not data Pin
Hum Dum26-May-10 1:30
Hum Dum26-May-10 1:30 
AnswerRe: Exporting only Defination not data Pin
Mike Osbahr26-May-10 2:17
Mike Osbahr26-May-10 2:17 
AnswerRe: Exporting only Defination not data Pin
Wayne Gaylard26-May-10 15:45
professionalWayne Gaylard26-May-10 15:45 
AnswerRe: Exporting only Defination not data Pin
SomeGuyThatIsMe27-May-10 2:03
SomeGuyThatIsMe27-May-10 2:03 
AnswerRe: Exporting only Defination not data Pin
Md. Marufuzzaman28-May-10 20:05
professionalMd. Marufuzzaman28-May-10 20:05 
QuestionA tale of two queries [solved] Pin
Mike Osbahr25-May-10 7:47
Mike Osbahr25-May-10 7:47 
AnswerRe: A tale of two queries Pin
Chris Meech25-May-10 8:01
Chris Meech25-May-10 8:01 
GeneralRe: A tale of two queries Pin
Mike Osbahr25-May-10 8:13
Mike Osbahr25-May-10 8:13 
AnswerInclude actual execution plan Pin
David Mujica25-May-10 8:06
David Mujica25-May-10 8:06 
GeneralRe: Include actual execution plan Pin
Mike Osbahr25-May-10 8:17
Mike Osbahr25-May-10 8:17 
QuestionRe: A tale of two queries - profiled [modified] Pin
Mike Osbahr25-May-10 10:13
Mike Osbahr25-May-10 10:13 
QuestionRe: A tale of two queries - profiled Pin
Mike Osbahr26-May-10 3:28
Mike Osbahr26-May-10 3:28 
AnswerRe: A tale of two queries Pin
Mike Osbahr26-May-10 4:16
Mike Osbahr26-May-10 4:16 
GeneralRe: A tale of two queries Pin
Tim Carmichael26-May-10 8:29
Tim Carmichael26-May-10 8:29 
QuestionMSSQL 2005 Drop / Create [Answered] Pin
Mike Osbahr25-May-10 4:44
Mike Osbahr25-May-10 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.