Quantcast
Channel: SQL Server Migration forum
Viewing all articles
Browse latest Browse all 1700

Referral Date Nightmare

$
0
0
Hello Guys,

I am somewhat new to SQL. I really need some help with the following query. I have three tables like so:

tblclient
perid
name
dob

tblreferral
refid
type
info
commments

tblreferralaction
refactid
status (allocate, nfa, closed)
status date

I need to get the list of referrals, per client, in chronological order using the dates from the referralaction table. A allocations status will be given once a referral is open. A status of NFA or Closed means that referral is closed. 
A client can have many referrals, i need to identify the current one and have the others with their open and closed dates.
I have tried pivoting the data and just cannot get it to work due to the various dates following on.

Please can someone help?! 

Thanks in advanced!

Kind Regards
Jonathan

Viewing all articles
Browse latest Browse all 1700

Trending Articles



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