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

Only clients with single output to be dispalyed

$
0
0
SELECT

	t1.new_applicantidname AS ClientName,
	t1.new_programmeappliedforidname AS BSUSProgramme,
	t2.new_programmeappliedforidname AS NEAProgramme,
	a1.new_evidenceforoutputidname as BSUSOutput, 
	a2.new_evidenceforoutputid,
	a2.new_evidenceforoutputidname as NEAoUtput,	
	t1.owneridname as BSUSOwner,
	t2.owneridname as NEAOwner,
	t1.new_laareaidname as BSUSLocalAuthority, 
	t2.new_laareaidname as NEALocalAuthority,
	--t1.new_businessstartdate as 'BSUS Business Start Date',
	t2.new_businessstartdate as 'NEA Business Start Date',
	--LEFT(CONVERT(nvarchar, a1.new_claimperiodidname ,107),3) + '-' + RIGHT(CONVERT(nvarchar,a1.new_claimperiodidname,107),2) as 'BSUS Claim Period',
	LEFT(CONVERT(nvarchar, a2.new_claimperiodidname ,107),3) + '-' + RIGHT(CONVERT(nvarchar,a2.new_claimperiodidname,107),2) as 'NEA Claim Period',
a2.new_verifiedok,a2.new_claimrefno
FROM FilteredNew_applicationform t1
INNER JOIN FilteredNew_applicationform t2
	ON t2.new_applicantid = t1.new_applicantid

/* Outer join for all BSUS business start records */
LEFT OUTER JOIN FilteredNew_evidence AS a1
	ON (t1.new_applicationformid = a1.new_relatedapplicationid)
	AND a1.new_evidenceforoutputidname IN ('Business Starts')
--AND a1.new_evidenceforoutputidname IN ('Starts On Scheme (post)')

INNER JOIN FilteredNew_evidence AS a2
	ON (t2.new_applicationformid = a2.new_relatedapplicationid)


WHERE t2.new_programmeappliedforidname = 'New Enterprise Allowance'

and t2.new_clientstageappnidname <> 'Part 9 - NEA1 - Business Plan Approval Date'

AND t1.new_programmecontractidname LIKE 'BSUS GM NEA%'

 

Hi All ,

In the above query can any one help me to get only Starts on scheme output(nothing else) for NEA cleints (a2.new_evidenceforoutputidname = ('Starts On Scheme '))

for e.g  i need to dispaly only QWR

Any help much appreciated

Thanks

Pradnya


Pradnya07




Viewing all articles
Browse latest Browse all 23857

Trending Articles



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