显示sql数据库中的一个唯一行(Display one unique row from sql database)
我想从表中显示一个具有相同值的重复行数的唯一行。 我试过这个sql查询,
select table1.activityhp, table2.id, table1.sequenceno from ServiceDataElementsNew as table1, VerticalsumNew as table2 where table1.verticalsumid = table2.id并得到这个结果:
activityhp id sequenceno Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 New acceptors 2 6 New acceptors 2 6 New acceptors 2 6 Repeat acceptors 3 10 Repeat acceptors 3 10 Repeat acceptors 3 10但我想要这个:
activityhp id sequenceno Total new and repeat acceptors 1 5 New acceptors 2 6 Repeat acceptors 3 10谢谢你的帮助!
I want to display one unique row from a table which have repeated number of rows with the same value. I have tried this sql query,
select table1.activityhp, table2.id, table1.sequenceno from ServiceDataElementsNew as table1, VerticalsumNew as table2 where table1.verticalsumid = table2.idand get the this result:
activityhp id sequenceno Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 Total new and repeat acceptors 1 5 New acceptors 2 6 New acceptors 2 6 New acceptors 2 6 Repeat acceptors 3 10 Repeat acceptors 3 10 Repeat acceptors 3 10But I want this:
activityhp id sequenceno Total new and repeat acceptors 1 5 New acceptors 2 6 Repeat acceptors 3 10Thanks for your help!
最满意答案
**add to query** group by table1.activityhp , table2.id ,table1.sequenceno **add to query** group by table1.activityhp , table2.id ,table1.sequenceno更多推荐
发布评论