Subject | Need some SQL help |
---|---|
Author | Riho-Rene Ellermaa |
Post date | 2003-09-05T10:49:46Z |
I have table called STATEMENTS where I have among other things 2 columns:
SDATE DATE,
OPTYPE VARCHAR(3)
SDATE contains dates and OPTYPE contains various operation types and 2 specific values - 'OB' (opening balance) and 'CB' (closing balance). For each 'OB' value there must be also 'CB'. For each day there may be more than one pair.
I want to check if there exists some orphan 'OB' or 'CB' values and rtrieve the dates of these cases. As my SQL knowledge is limited to SELECT * FROM xxx :-) , I need some help.
Is it possible to get the info with one SQL sentence?
Riho-Rene Ellermaa
senior programmer
SDATE DATE,
OPTYPE VARCHAR(3)
SDATE contains dates and OPTYPE contains various operation types and 2 specific values - 'OB' (opening balance) and 'CB' (closing balance). For each 'OB' value there must be also 'CB'. For each day there may be more than one pair.
I want to check if there exists some orphan 'OB' or 'CB' values and rtrieve the dates of these cases. As my SQL knowledge is limited to SELECT * FROM xxx :-) , I need some help.
Is it possible to get the info with one SQL sentence?
Riho-Rene Ellermaa
senior programmer