what kind of query?

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
 
M

mcnews

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top