有两个表,
table1
col1 col2
1 a
2 b
3 c
4 d
...tabel2
col1 col2
a 10
a 12
b 7
b 7
c 45
....
现在先根据table2中的分组统计(要用外连接,将table1中col2中的东西都列出来),然后根据table1中的col1排序
这怎么做啊
select table1.col2,sum(col2) from table1,table2 where table1*=table2 group by table1.col2 ????
这个后面怎么写才能排序?
table1
col1 col2
1 a
2 b
3 c
4 d
...tabel2
col1 col2
a 10
a 12
b 7
b 7
c 45
....
现在先根据table2中的分组统计(要用外连接,将table1中col2中的东西都列出来),然后根据table1中的col1排序
这怎么做啊
select table1.col2,sum(col2) from table1,table2 where table1*=table2 group by table1.col2 ????
这个后面怎么写才能排序?
table1
col1 col2
1 10
2 7
3 8
4 6
5 长10col2是varchar类型
如何使col2中数字的可以正常排序啊?
table1
col1 col2
1 10
2 7
3 8
4 6
5 长10col2是varchar类型
如何使col2中数字的可以正常排序啊?
==========================
试试:
select * from testtable order by col2*1