You are here: Re: Query: union on self « MsSQL Server « IT news, forums, messages
Re: Query: union on self

Posted by Alexander Kuznetsov on 07/11/06 20:35

Thomas,

thanks for the correction. Untested again, no DDL, no DML!

SELECT qi_id, t.c AS type
FROM qt_ins join
(
select 1 n, 'Injury' c
union all
select 2 n, 'environmental' c
union all
select 3 n, 'Equipment damage' c
union all
select 4 n, 'Vehicle' c
) t
on (qi_injury = 1 and t.n=1) or (qi_environmental = 1 and t.n=2) or
(qi_equipment_damage = 1 and t.n=3)
or (qi_vehicle = 1 and t.n=4)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация