Solved

Syntax COUNT + HAVING in Informix

Posted on 1998-10-28
2
2,336 Views
Last Modified: 2008-03-17
Hi,

I try to do the following query (which I thought is plain SQL), but it results in an error:

SELECT person_id
FROM job_function
GROUP BY person_id
HAVING COUNT(person_id) > 1

(IN NL: Give me all person_id's of those rows in the table that have this person_id more than once, which means, "Give me all persons with more than one function").

The database complains that the syntax is not OK. It isn't usefull, but when I put a distinct inside the COUNT, the answer of course is wrong, but the syntax seems right.... It seems the problem is a COUNT(field) is not supported, whereas a COUNT(*) is supported.

The database used is a very stripped Informix that was delivered with the Netscape Enterprise 2.0 webserver, with LiveWire Pro....

I think it's just a difference in syntax....

Cheers,


George
0
Comment
Question by:georgedb
2 Comments
 

Accepted Solution

by:
jstegink earned 20 total points
Comment Utility
George,

I have tried it with a Access Database via ODBC and the syntax you use works with me fine! So don't make any typing errors!!

Maybe you should try to use COUNT(*) instead of using COUNT( person_id) the result should be the same.
0
 

Author Comment

by:georgedb
Comment Utility
Well, the answer stinks, but what the heck (hack). Basically you're right.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now