Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

IN SQL, HAVING CLAUSE

Status
Not open for further replies.

Soham1087

Banned
Junior Member level 1
Joined
May 31, 2022
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
India
Activity points
185
I'm attempting to figure out why certain DBMS systems allow the following but others don't. Assume table X contains the following attributes: name, id, and data.
Code:
SELECT id, count(*) as count
FROM TABLE X
GROUP BY id
HAVING count > X.data
It is forbidden in most databases to utilize a non-grouping or non-aggregate field in a HAVING clause conditional statement. Some systems appear to permit the same. Could you explain why they would have permitted the HAVING condition to utilize a property that may not have a unique value throughout the group? I found some useful info but need further explanation. Database documentation for DB2, PostgreSQL, and MySQL was consulted.
Code:
SELECT id, count(*) as count
FROM TABLE X
GROUP BY id
HAVING count > X.data
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top