DetailID HeaderID SetID ShiftID Amount
DetailID is the primary key and HeaderID is a foreign key related to the Header Table. The ShiftID is a foreign key to the Shift table. The HeaderID will generally have multiple SetID's. When the ShiftIDs and Amounts are the same with a different SetID I would like to return only one of the SetIDs and the related ShiftIDs and Amounts. As an example:
| Header | Set | Shift | Amount |
| 973 | 1 | 171 | 10 |
| 973 | 1 | 138 | 2 |
| 973 | 1 | 157 | 19 |
| 973 | 1 | 123 | 13 |
| 973 | 1 | 172 | 5 |
| 973 | 1 | 153 | 2 |
| 973 | 1 | 163 | 5 |
| 973 | 2 | 171 | 9 |
| 973 | 2 | 138 | 13 |
| 973 | 2 | 166 | 6 |
| 973 | 2 | 157 | 12 |
| 973 | 2 | 143 | 12 |
| 973 | 2 | 123 | 2 |
| 973 | 2 | 153 | 1 |
| 973 | 2 | 168 | 1 |
| 973 | 3 | 171 | 9 |
| 973 | 3 | 138 | 13 |
| 973 | 3 | 166 | 6 |
| 973 | 3 | 157 | 12 |
| 973 | 3 | 143 | 12 |
| 973 | 3 | 123 | 2 |
| 973 | 3 | 153 | 1 |
| 973 | 3 | 168 | 1 |
Sets 2 and 3 are identical so I would like to only return sets 1 and 2 or sets 1 and 3 with the table headers showing.
Thank you
Amit ChoudharyPosted Mar 3, 2010, 11:37 PM
you can do it by writing query like below:
"select SetID, ShiftID, Amount from TestTable where SetID=[pass the value of setid] "
hope it helps you.
Lee SheenePosted Mar 11, 2010, 12:51 PM
"select SetID, ShiftID, Amount from TestTable where ShiftID=[pass the value of ShiftID] "
Rodney JohnsonPosted Mar 4, 2010, 7:39 AM
Amit, this does help. However, my struggle is in choosing the setID(s). The overall program runs, creates up to 7 sets and then displays the results. The data is not seen by the user. I am not sure how to efficiently compare sets 1 thourgh 7 then return the unique sets.
Thank you,
Rod