sql server - Crystal Reports get all records relative to a field -
the task simple looks complicated crystal reports
i have table
id groupid partyid ..... 1 1 1 2 1 2 3 1 3 4 2 2 5 2 1 ... on
so groupid
there can different party records
now want group records of party # 1, should return groups 1 , 2 both
and if want records party # 3, should return group 1 records (ids 1,2 , 3)
i have partyid
sent crystal reports parameter.
what happens when use parameter filer results, particular party record. e.g. if part id = 1 records id=1 , 5 only, while should records 1 5 , if party id = 3 passed, record id=3, while should (or want get) records id=1,2 , 3
how can achieve this?
you can use self-join accomplish this. using 1 copy of table identify groupid
values associated partyid
, using second copy of table find rows groupid
values.
select table1.id, table1.groupid, table1.partyid table table1 inner join table table2 on table1.groupid = table2.groupid table2.partyid = <<partyid>>
Comments
Post a Comment