Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
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




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]
Posted
Updated 17-Apr-12 22:15pm
v2

1 solution

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900