insert into t3(field1,filed2) Select 1,(select filed2 from t2 where id=1) From t2 group by 1
insert into t(filed1,filed2) seelct 1,col1 from tb
可行,,原来group by还可以这样用!谢谢。。
lxq19851204,弱弱问一下,group by 1本质含义是什么,1代表什么意思,我只知道它可以跟字段,但每见过这种用法。。
insert into t select 'aaa',某个字段 from 另外一个表
group by 1以及 order by 1. 数字1指的是select段指定位置的编号. 1是指一号位置 select id ,count(*) from table group by 1; 等价于 select id ,count(*) from table group by id; 如果你写成 select id ,count(*) from table group by 2; 就会报错.
Select 1,(select filed2 from t2 where id=1) From t2 group by 1
seelct 1,col1 from tb
可行,,原来group by还可以这样用!谢谢。。
lxq19851204,弱弱问一下,group by 1本质含义是什么,1代表什么意思,我只知道它可以跟字段,但每见过这种用法。。
数字1指的是select段指定位置的编号.
1是指一号位置
select id ,count(*) from table group by 1;
等价于
select id ,count(*) from table group by id;
如果你写成
select id ,count(*) from table group by 2;
就会报错.