Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Query Help

Author  Topic 

jim_jim
Constraint Violating Yak Guru

306 Posts

Posted - 2011-11-19 : 20:05:58
I get a monthly data feed in excel with pcpid and memberid information.I'm supposed to get member information for all the members associated only with the pcpid in the spreadsheet

How do i write a query so that i associate a memberid only with the pcpid given in the spreadsheet

The problem iam having is when i write a query to bring the member information by providing pcpid in list is i get multiple records for a member as the member might earlier be associated with another memberid


Thanks
Jim

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-20 : 01:42:05
sorry didnt understand one thing. if you've memberid in spreadsheet why cant you use it for looking up details of member directly. why should you use ppid to get related members and then their infrmation.
Also if more than members are associated with same ppid, which one should you return? is there some other unique valued column on basis of which you determine that.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

johntech
Yak Posting Veteran

51 Posts

Posted - 2011-11-21 : 04:56:34
I'm not sure if i understand you ,But as i thought that you need to add 2 conditions to determine the specific row u need ,Or you can use a composite primary key so you need to write "where pcpid=@id and 'another condition'"

Thanks
Go to Top of Page
   

- Advertisement -