Solved

Syntax COUNT + HAVING in Informix

Posted on 1998-10-28
2
2,372 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
ID: 1090871
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
ID: 1090872
Well, the answer stinks, but what the heck (hack). Basically you're right.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

792 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