|
Posted by David Portas on 06/08/05 23:27
What's the key of this table? It would be useful to know. Assuming it is
key_col, you could do this:
SELECT code1, code2, code3, foo1, foo2
FROM YourTable AS T
WHERE key_col =
(SELECT MIN(key_col)
FROM YourTable
WHERE code1 = T.code1
AND code2 = T.code2
AND code3 = T.code3)
This also assumes that code1, code2 and code3 are non-nullable columns.
Again, it does help if you post a better spec of your problem. The best way
is to include DDL (CREATE TABLE statement including keys and constraints),
sample data (INSERT statements) and show your required end results.
Otherwise answers are just guesswork.
--
David Portas
SQL Server MVP
--
[Back to original message]
|