select *
from (
select fieldname as col1 from tablename where fieldname like 'A%'
) as a,(
select fieldname as col2 from tablename where fieldname like 'B%'
) as b,(
select fieldname as col3 from tablename where fieldname like 'C%'
) as c,(
select fieldname as col4 from tablename where fieldname like 'D%'
) as d

解决方案 »

  1.   

    谢谢CEO,我的问题已经解决了,虽然分分不多,但还是结帐先,另外我还想问一下,如果我还想在这个最终的组合中加三列,并且赋值,如下加的三列:
    第一列  第二列   第三列
      AA      BB       BB
    即所有组合后的记录都赋予上面的列值。
      

  2.   

    select *, AA as 第一列, BB as 第二列, BB as 第三列
    from (
    select fieldname as col1 from tablename where fieldname like 'A%'
    ) as a,(
    select fieldname as col2 from tablename where fieldname like 'B%'
    ) as b,(
    select fieldname as col3 from tablename where fieldname like 'C%'
    ) as c,(
    select fieldname as col4 from tablename where fieldname like 'D%'
    ) as d