计算查询结果中的重复项 [英] counting the duplicates in query result

查看:47
本文介绍了计算查询结果中的重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select  A.*,B.sitename,B.buildingno from gen_complaints as A, building_master as B where A.lacation=B.buildingno group by B.buildingno




这是我的查询,它显示出来像滚滚一样




this is my query it is show ing out put like billow

7	GENCN7	2012-04-13	General	Low	Plumbing	1341	dfgdfshgdsfhgdsfg			jana reddy	jana@mindworks.co.in	571658	Pending		208	WATTAYAH MOTORS LLC		\N	\N	\N	\N	\N	FARAH BLDG MBD	1341
8	GENCN8	2012-04-13	General	High	Electrical	1341	hfjgfhjgfj			0	jana@mindworks.co.in	571658	Pending		208	WATTAYAH MOTORS LLC		\N	\N	\N	\N	\N	FARAH BLDG MBD	1341
3	GENCN3	2012-04-05	General	Low	Plumbing	3425	nmgbv dvbdfbdgfdsgdg	2012-04-25	support	client	jana@mindworks.co.in	24446501 Mr Waljeet, Badar	Completed		17	VOLTAMP TRANSFORMERS OMAN-17		hgj	ghj	55.235	gjh	2012-04-11	777 AL KHUWAIR	3425
5	GENCN5	2012-04-10	General	Low	Landscaping	3425	hfgf	2012-04-30	support	g	f	456	Completed	0	1			1	1	265.235	1	\N	777 AL KHUWAIR	3425
2	GENCN2	2012-04-05	General	High	Carpentry	945	ytr	2012-04-17	support	jana reddy	jana@mindworks.co.in	24703222 /99607687	Completed		17	BAIT AL OSOOL		ghj	hgj	30.12	ghjghjghjgfjghjghfjhgj	2012-04-12	MQE GARDEN COURT ROOLEH6	945
4	GENCN4	2012-04-06	General	Low	Carpentry	945	hjkhjkhgfj	2012-04-18	support	jana reddy	jana@mindworks.co.in	24763542/99796405	Processing		15	BAIT AL OSOOL		dgfh	fdgh	256.236	rtyytrerghdgfhgfhdgfh	2012-04-13	MQE GARDEN COURT ROOLEH6	945
1	GENCN1	2012-04-05	Equipment	High	Carpentry	716-SHOP	testing	2012-04-30	support	jana reddy	jana@mindworks.co.in	24784602/99009473 Mr Hanif	Pending	SAWMDBOO03	6	ABU DOHA TRADING		5	5	25.15	5	\N	REX-SHOPS	716-SHOP
9	GENCN9	2012-04-14	General	High	Carpentry	17	hgjkhgk			jana reddy		24714636/24714707	Pending		1	CORNICHE HOTELS CO. L.L.C		\N	\N	\N	\N	\N	CORNICHE  HOTEL	17
6	GENCN6	2012-04-12	General	Low	Plumbing	752	complaint from mindworks office			jana reddy	jana@aol.com	24814200	Pending		12	MEHDI STORE LLC-752-2		\N	\N	\N	\N	\N	SEEB SOUQ	752

br/>


如果看到最后一列建筑物编号,则建筑物编号正在重复....

我想算一算,每座建筑物没有重复多少次..

例如,如果1341重复了2次,所以我想算2我该怎么做,

[edit]已添加代码块-OriginalGriff [/edit]





if you see the last column building no, building no is repeating....

i want to count that each building no that how many times it is repeating ..

eg if 1341 repeted 2 times so i want count 2 how can i do this,,

[edit]Code block added - OriginalGriff[/edit]

推荐答案

try:
try :
select B.buildingno, count(*) from from gen_complaints as A, building_master as B where A.lacation=B.buildingno group by B.buildingno


这篇关于计算查询结果中的重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆