all groups > sql server full text search > july 2006 >
You're in the

sql server full text search

group:

Select First Record


Select First Record rookie
7/27/2006 1:24:03 PM
sql server full text search:
I have a table with all the support tickets of my clients, I need to know,
whene was the first ticket of each user, I know distinct can do that, but I
need the full row.

I tried this:
SELECT * FROM `MyCRM`.`ticket_history` a where Fecha = (SELECT MIN(b.Fecha)
FROM `MyCRM`.`ticket_history` b WHERE b.Fecha = a.Fecha)

but it didnt worked...

Re: Select First Record Simon Sabin
7/27/2006 11:13:44 PM
Hello rookie,
SELECT TOP 1 columns1, column2 etc...
FROM MyCRM.ticket_history
ORDER BY Fecha ASC

If Fecha is the column holding the date the ticket was posted.

ps you shouldn't really use select *

Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons


[quoted text, click to view]

AddThis Social Bookmark Button