c# - sql query, selecting data through 3 tables -
i have db below: (sorry couldn't upload diagram)
group table:
grp_id smallint grp_name char(50)
type table:
tp_id smallint tp_name char(50)
item table:
it_id int grp_id smallint tp_id smallint
item table linked group table grp_id, , linked type table via tp_id.
the user enter grp_name
or grp_id
, , should realize item have group , add type names of them, type table checklistbox
.
select it_id, tp_name item inner join type on type.tp_id = item.tp_id inner join [group] on [group].grp_id = item.grp_id [group].grp_id = @groupid or [group].grp_name = @groupname
Comments
Post a Comment