Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

how to check for account type changes

$
0
0

i have a table which has data like this

CustomerID CUST_SKEY StartDate EndDate AcctType COOPCode

1 123 2014-01-07 2014-01-14 OTH 20
2 147 2014-04-06 2014-04-12 TRS 12
3 789 2014-03-16 2014-03-22 XYZ 60
4 789 2014-03-23 2014-03-29 XYZ 90
5 789 2014-03-23 9999-12-31 XYZ 60
6 123 2014-01-15 2014-01-22 LML 20
7 123 2014-01-23 9999-12-31 LML 20
8 147 2014-04-06 2014-04-12 OTH 12

Find customers who changed coopcode from one coopcode to another and back to original coopcode
Find customer who changed accttype from one accttypecode to anther and back to original acctytpe
Find customer who has same STARTdate for a single customer?

Should i use a self join to find the answers?

Or should i use a CTE?

Can somebody help pls


Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>