sql server 2008 - SQL returning all rows in one table where a column valule is equal to matching column value joined to another table -
for example lets have table info contains columns:
id - name - address
have second table purchases contains columns:
region - name - purchases
multiple people can in same region, each person has 1 id.
i want write query will, based on given id in info table, return rows in purchases of people live in same region person specified id.
have done inner join on name 2 tables can't figure out best way write query.
edit: main problem there no region column in info. way region joining purchases table. need results of rows containing region.
i not sure if want twik bit better fit needs:
select purchasse purchasse inner join info on info.name = purchasse.name info.id = yourid
this should give purchasse
given id
name
match 2 columns.
Comments
Post a Comment