Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    Ohio/Chicago
    Posts
    75

    Unanswered: query help: case statement issues

    Can anyone spot the error in this situation?

    Code:
    SELECT x.requestNumber,x.ContactFullName, x.webcastname,
    	CASE 
    	when p.presenters = '0'
    		then  x.presenters
    		else
    		  ISNULL(p.presenters,x.presenters)
    	as presenters
    FROM [request].[dbo].[Postreceived] as p
    Right outer JOIN [othercomputer].[request].[dbo].[Prereceived] as x 
    on p.requestNumber = x.requestNumber
    I hope this makes sense, when
    p.presenters is 0 or if it is null, then i want to return x.presenters, else just return p.presenters and call the colum presenters in the return.

    It barfs on the as in this situation and if i take it out it barfs on the FROM.

  2. #2
    Join Date
    Aug 2003
    Posts
    4

    Re: query help: case statement issues

    You need an END after "as presenters" to close out the CASE statement.

  3. #3
    Join Date
    Jul 2003
    Location
    Ohio/Chicago
    Posts
    75
    ahhh cripes, good catch.

    but the case returns the value, you'd need to put the 'as name' after the end.

    thanks for the help, i was staring at this for a while trying to remember what i was forgetting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •