This question is complex so the examples will work best ... I have the following table on ODBC, SQL Server is not management
NAME SEQNUM JOHN 2 JOHN 4 JOHN 7 MARY 12 MIKE 4 MIKE 9 PETER 7 PETER 12
Therefore, I return a name with the lowest ranking I want to draw SEQNUM JOHN 2 MARY 12 MIKE 4 PETER 7
This data will not work with Reminds the comment: If you simply use the If you use the SELECT (MIN (SEQNUM))
. She gives a number I want to put the actual data into my dataset. Does anyone know how to do that?
name by group
, then your selection list only name
and the overall function MIN ()
. This is often the case that in fact you want the whole line where the minimum value per group is. TOP
solution (or LIMIT
) you use MySQL, PostgreSQL, SQLite), then you You can not get minimum for many groups based on the name
, you can get a minimum for only one name
. I read between the lines of OP questions and guessed that they want the whole line, that there are more columns (and always) than the tasks shown in the question, and the desired query results for many Give the name, not just one
However, this solution may not use the index to evaluate potentially connectivity, while I have the solution given.
Comments
Post a Comment