Hello,
I am trying to learn SQL query, and I have asked to come up with a collation of data from other tables, but one of the columns might not have data in it, but if it does, I need to find a matching vale and place in another column, ie

if group_id >0 then find the matching IDs description and put in the group_description column, else leave both blank.
my code (amended for brevity) looks like
INSERT @RESresults
SELECT OtherVariables,a.group_id,'',MoreVariables
FROM resTable a , @findInfo b , andOTHERtables
WHERE a.guest_id = b.guest_id
and b.country_id = a.country_id
MORE "ands"
GROUP BY re_id], etc
What I cannot work out is how, and where (and if) to put the comparison.
I can do a "and" like I have with other matchs, but if the group_id = 0, then I loose this information from the table.
I need to keep all the rows, but add the corresponding IDs description =if the group_id >0. Ie

Could someone explain to me how I can do this please ?
Many Thanks in advance