View Single Post

   
  #4 (permalink)  
Old 02-29-2008, 07:53 PM
Alexander Kuznetsov
 
Posts: n/a
Default Re: Query: union on self

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?

Reply With Quote