标签:style ar sp on 问题 cti bs as sql
我想对code这一列做分组统计,请问大神sql语句该怎么写?
这是我写的sql语句
SELECT
t1.id,
t1.code,
t1.[count],
dbo.dictText (t1.dwmc, ‘dwmc‘) AS dwmc,
dbo.dictText (t1. LEVEL, ‘tar_level0‘) AS LEVEL,
dbo.dictText (t1.wd_id, ‘wd_detail‘) AS wd_id,
dbo.dictText (t1.bd_id, ‘bd_detail‘) AS bd_id,
dbo.dictText (t1.property, ‘tar_property‘) AS property,
dbo.dictText (t1.data_from,‘tar_datafrom‘) AS data_from,
t1.create_time,
t1.repeal_time
FROM
tar_rentou t1
INNER JOIN activity t2 ON t2.target_code = t1.code
执行后的sql语句如下图
id | code | count | dwmc |
1 | RT001 | 郑州 | |
1 | RT001 | 郑州 |
我想要的结果是这样的包括其它列该如何写sql语句
id | code | count | dwmc |
1 | RT001 | 2 | 郑州 |
标签:style ar sp on 问题 cti bs as sql
原文地址:http://my.oschina.net/1024345181/blog/337896