what kind of query?

  • Thread starter Thread starter mcnews
  • Start date Start date
M

mcnews

my table looks like

id type1 type2 type3
xxx1 t1 t2
xxx2 t2
xxx3 t3
xxx4 t1 t3
xxx5 t1
xxx6 t2


i need it to look like
id type
xxx1 t1
xxx4 t1
xxx5 t1
xxx1 t2
xxx2 t2
xxx6 t2
xxx3 t3
xxx4 t3

changing the table structure is not an option

tia,
mcnewsxp
 
select Id, xtype
, stype as stype
from MyTable where boollabel = true
union all
select Id, xtype
, stype2
from MyTable where boollabel = true and stype2 <> Null
union all
select Id, xtype
, stype3
from MyTable where boollabel = true and stype3 <> Null
ORDER BY stype
 
Back
Top