我想问一下这个
示例:
1. 10078 2. 10049 3. 60232 4. 10323 5. 60032 6. 60879 7. 10378 8. 60012 9. 67321
我想像这样改变它
Column1 Column2 10078 60232 10078 60032 10049 60879 10323 67321 10378 60012
Currenctly我的查询是这样的:
Select [column_name] as Column1 from [table_name] where [column_name] like '1%'
Select [column_name] as Column1 from [table_name] where [column_name] like '6%'
问题是我无法弄清楚如何将1列分成2列并保持数据连接。
*我的朋友告诉我使用不同的观点,但我无法弄明白代码
答案 0 :(得分:0)
我认为以下SQL对您有用。
select column1, column2, column1/column2 as div_value
(
Select [column_name] as Column1
from [table_name]
where [column_name] like '1%') as t1
join
(
Select [column_name] as Column2
from [table_name]
where [column_name] like '6%'
)as t2
谢谢。