October 2, 2014 at 9:27 am
Hi there
I am using the following statement in an attempt to retrieve details of all people who have the subcodes as shown. However, only one person per subcode is getting retrieved. So, rather than having for example, 500 people with AFF and 20 with GAF, I am only getting back 1 of each.
Could someone please tell me what I'm doing wrong in my statement?
select ContactID, Forenames, Surname, SubscriptionTypes.SubCode
from Contacts
INNER JOIN SubscriptionTypes
ON SubscriptionTypes.ID=Contacts.ContactID
WHERE Subcode IN ('AFF','AFF2','AFF3','AFFLGDP','AFFOS','GAF','GAFFM','GAFFMOS','GAFLGDP','GAFOS','RAF')
Many thanks
Jon
October 3, 2014 at 3:16 pm
The query looks valid.
Please provide table def and sample data together with your expected result based on the sample data provided.
Otherwise we'd just be guessing here...
October 6, 2014 at 1:48 am
Hi Lutz
Thank you for your reply. I have re-looked at the tables in my query and it seems as though I was missing a table which held all the relevant information.
So, on this occasion we can put it down to "newbie error".
Many thanks for your time.
Best wishes
Jon
October 29, 2014 at 1:26 am
:w00t:
SSMS Expert
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply