Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub-query worries

Status
Not open for further replies.

bombdropVB

Programmer
Joined
Dec 3, 2002
Messages
59
Location
GB
Now i need to perform a sub query .

Code:
declare @AccountCode int
set @AccountCode=5




SELECT 
	c.clientshort,
	c.clientname,
	c.contact1,
	c.telephone1,
	c.fax1,
	c.email1a,    
	a.address1+a.address2+a.address3 +a.address5+a.address6 + a.postcode AS Address
 FROM 
	ace.dbo.Client c 
		INNER JOIN ACE.dbo.Address a ON 
			c.addressref = a.addressref 

		INNER JOIN ACE.dbo.claim ON
			ACE.dbo.claim.clientref=c.clientref

		INNER JOIN ACE.dbo.policy p  ON
			ACE.dbo.claim.policyref =  p.policyref
WHERE 
	p.certificate= (	SELECT 
					shortname
				FROM 
					gamaccount
				WHERE 
				accountref=@AccountCode
					)

this return no row but it should return 1

I i run the sub-query on its own it returns the value i am looking for namely '96/02/00276'.
if I place 96/02/00276 in the where statement instead of the sub query i get the desidered result but i need this wo work as a sub query as i wish to coonvert to a an SP any one help please??
 
Sorry about this but it is my fault in the table gamaccount where i obtain the Short name i had cut and pasted an entery in an it had extra characters on the end
sorry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top