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...
Simon Sabin - 28 Jul 2006 00:13 GMT
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
> 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
[quoted text clipped - 5 lines]
> FROM `MyCRM`.`ticket_history` b WHERE b.Fecha = a.Fecha)
> but it didnt worked...