Posted by Thomas R. Hummel on 07/11/06 13:47
Alexander Kuznetsov wrote:
> You can try something like this:
>
> SELECT qi_id,
> case
> when qi_injury = 1 then 'Injury'
> when qi_environmental = 1 then 'environmental'
> when qi_Equipment damage = 1 then 'Equipment damage'
> when qi_Vehicle = 1 then 'Vehicle'
> end
> AS type
> FROM qt_ins
> WHERE (qi_injury = 1) or (qi_environmental = 1 ) or
> (qi_equipment_damage = 1)
> or (qi_vehicle = 1)
>
> But it would be interesting to see why is your original query slow. Any
> additional infotrmation?
I just posted that this was a good solution in another post, but now it
occurs to me that it will not return the same resultset as the original
poster's solution. The query above will return only one row per qi_id,
but the original solution could return up to four for each qi_id.
-Tom.
[Back to original message]
|