name列,words列
生成一个新列
结果为name+"说:"+words
如:
name words
--------------
I hi
===>
saywords
--------------
I说:hi
SQL code:
select name+'说:'+words as saywords from tb
SQL code:
select [name],words,saywords ......
select s.name,
sum(if(o.cp>0,1,0)) as c,
sum(if(o.cp=0,1,0)) as h,
sum(o.p) as p,
sum(o.u) as u,
published,s.id
from table_s as s inner join table_o as o
on s.middle=o.middle group by s.name where published = 1 ORDER BY s.id asc
上面的sql语句 去掉 where publish ......
例表如下:
姓名 部门 职级 工资等级
张三 1 A 01
李四 2 A ......
数据
|Field1| Field2| Field3|
| F1 | x1 1
| F2 | xx1 3
| F1 | x1 2
| F1 | x2 & ......
我有一个表,里面包含有很多用户每次的摇奖记录,
username d1 d2
aa 4 5
bb 4 2
aa & ......
SQL code:
SELECT cls.*, yplan.*
from Mpt_CostItem cls INNER JOIN
Mpt_YearPlan yplan ON cls.CostItem_ID = yplan.YearPlan_ItemID
GROUP BY yplan.YearPlan_ItemID
ORDER BY yplan.YearPlan_ID
上面的语运行肯定是通不过的如果改成这样
SQL code:
SELECT max(cls.字段), max(yplan.字段)
f ......