![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have one table used to maintain information on Service Events. Each record contains a Repair, Maint, and Battery checkbox (bound/boolean). Any one of these fields may be checked or left empty. Ex. REPAIR=True, MAINT=False, BATTERY=True I want to generate ONE report that lists all the REPAIRS, then lists all the MAINT, and then lists all the BATTERY events. One group after the other in the same report. Because (ex. REPAIR and BATTERY) may both be true in the same record, the record will appear 2 times in the report, once in the REPAIR group and once in the BATTERY group. I am not sure how to approach this. I'm new to SQL. I' m using MS AccessSQL. I Tried the following code, but the results are not sorting properly and not grouped. SELECT * FROM [TABLE1] WHERE [REPAIR] UNION ALL SELECT * FROM [TABLE1] WHERE [MAINT] UNION ALL SELECT * FROM [TABLE1] WHERE [BATTERY] |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thanks for the response. I took your advice and tried the following code: SELECT IIf([RPR]=True,"RPR", IIf([MNT]=True,"MNT", IIf([BAT]=True,"BAT","Unknown"))) AS GroupByThis, [RPR], [BAT], [MNT], * FROM [T-SERVICE]; The repairs have grouped just fine, but the battery and maint will only group with records that are not already displayed in the repairs group. |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |