General discussion

Locked

SQL Select troubles

By AT_1973 ·
I have a table that contains contact ID's and what group they are associted with. I am trying to grab all the contact ID's that have a group of '32', then take all those Contact ID's and grab their contact details from a different table.

GROUP_ASSIGNMENTS
groupType | ContactID

CONTACTS
ContactID | Name | Address | ETC

I would like to wrap this into a single statement, but I cannot figure the sytntax to accomplish this. My other alternative is to load the selected ContactID's into a temporary table and then go back and query Contacts table for each of the ID's in the temp table.

Any help would be greatly appreciated. Thanks!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Try this

by LocoLobo In reply to SQL Select troubles

SELECT contacts.ContactID, contacts.Name, contacts.ETC
FROM contacts, group_assignments
WHERE contacts.ContactID = group_assignments.ContactID
and group_assignments.groupType = 32;

Not sure if I read it right.

Collapse -

Ugh..

by AT_1973 In reply to Try this

I don't know why I didn't come here sooner! Thank you!

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums