Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

SQL GROUP BY AND HAVING

SELECT Table1.ID, Table1.Awaiting, Table1.Approve, Table1.Decline
FROM Table1
INNER JOIN (
  SELECT ID
  FROM table1
  GROUP BY ID
  HAVING COUNT(*) = 2
  AND MAX(awaiting = 1) > 0
) q ON Table1.ID = q.ID
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #SQL #GROUP #BY #AND #HAVING
ADD COMMENT
Topic
Name
9+3 =