Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why this query is showing multiple result

Status
Not open for further replies.

Arun Mahajan

Programmer
Nov 29, 2019
2
IN
Why the following query gives multiple rows

SELECT
IF(ISNULL(trim(insured_ecard_path)), 'NULL', 'NOT NULL') as value,
COUNT(*)
FROM hrms_medical_gmc
where cmpcode='AT161'
GROUP BY insured_ecard_path

NOT NULL
4
NOT NULL
4
NOT NULL
4
NOT NULL
3
NOT NULL
5
NOT NULL
4
NOT NULL
6
NOT NULL
3
NOT NULL
4
NOT NULL
4
NOT NULL
4
NOT NULL
4
NOT NULL
4
NOT NULL
3
NOT NULL
2
NOT NULL
4
NOT NULL
5
NOT NULL
6
NOT NULL
5
NOT NULL
5
NOT NULL
5
NOT NULL
5
NOT NULL
4
NOT NULL
3
NOT NULL
 
Hi

Probably because the [tt]group by[/tt] clause results that many distinct values. Maybe you want [tt]group by value[/tt] instead ?


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top