I was looking at this link , but was still having trouble creating my statement. I have the following query
SELECT SUM(AMT) AS TOTAL, NAME, YEAR
FROM TABLE WHERE IND='ISVALID' GROUP BY NAME, YEAR
I would get the following results
TOTAL | NAME | YEAR
====================
10000 | JOHN | 2010
20500 | PETE | 2009
12500 | MIKE | 2008
50500 | MARY | 2008
50500 | MARY | 2007
40000 | JANE | 2007
I would like to exclude 50500 | MARY | 2008, which has an IND column with 'ISVALID' as well. How do I do this?
SELECT SUM(AMT) AS TOTAL, NAME, YEAR
FROM TABLE
WHERE IND='ISVALID' AND (NAME <> 'MARY' OR YEAR <> 2008)
GROUP BY NAME, YEAR
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.