|
Posted by --CELKO-- on 10/14/05 04:26
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.
After that ABSOLUTELY BASIC PIECE OF NETIQUETTE, did you read what you
posted? What the @!$% specs for this?? Wait, wait, let me read your
mind and guess that you want to see only those rows whose col_1 groups
have one and only one value for col_2 !!
SELECT F1.col1, F2.col2
FROM Foobar AS F1
LEFT OUTER JOIN
(SELECT col1, MIN(col2)
FROM Foobar
GROUP BY col1
HAVING MIN(col2) = MAX(col2))
AS F2 (col1, col2)
ON F1.col1 = F2.col1;
If you plan to stay in this trade, please learn minimal Netiquette and
how to write a minimal specification.
Navigation:
[Reply to this message]
|