SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 WHERE EXIST QUESTION HELP PLZ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rv498
Yak Posting Veteran

USA
60 Posts

Posted - 03/03/2014 :  18:53:56  Show Profile  Reply with Quote
Use a subquery and the EXISTS predicate to find customers that respond to surveys. List full name and email address.
-- Try the CONCAT() function for the name.
-- 1656 rows

SELECT CONCAT(C.LastName,', ',C.FirstName,C.MiddleName), C.EmailAddress
FROM dbo.DimCustomer AS C
WHERE EXISTS
(SELECT SurveyResponseKey
FROM dbo.FactSurveyResponse
WHERE dbo.DimCustomer.CustomerKey = CustomerKey)

This is my first attempt at EXISTS AND so far it doesn't work. Any help would be greatly appreciated.

bitsmed
Constraint Violating Yak Guru

405 Posts

Posted - 03/03/2014 :  19:01:04  Show Profile  Reply with Quote
quote:
Originally posted by rv498

Use a subquery and the EXISTS predicate to find customers that respond to surveys. List full name and email address.
-- Try the CONCAT() function for the name.
-- 1656 rows

SELECT CONCAT(C.LastName,', ',C.FirstName,C.MiddleName), C.EmailAddress
FROM dbo.DimCustomer AS C
WHERE EXISTS
(SELECT SurveyResponseKey
FROM dbo.FactSurveyResponse
WHERE dbo.DimCustomerFactSurveyResponse.CustomerKey = C.CustomerKey)

This is my first attempt at EXISTS AND so far it doesn't work. Any help would be greatly appreciated.

Go to Top of Page

rv498
Yak Posting Veteran

USA
60 Posts

Posted - 03/04/2014 :  00:08:21  Show Profile  Reply with Quote
Thanks bitsmed, I see I didn't catch that.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000