1

I have a table in Oracle Apex populated with contacts and their information. On the dashboard of my app, I'd like it to say how many contacts are in the database using the big list of values plug-in or something like that. I'm using the following code:

select contact_ID, count(*)
from
contacts
group by contact_id

However all I'm getting is the number of times each specific contact appears in the table (which is 1), instead of the total number of contacts. I understand what I did wrong in the code, but I'm not sure how to fix it.

For further information, the table columns are very basic, just 'Name', 'contact_id' (the primary key), 'Phone_Number', and so on. The table is called CONTACTS.

I'm also looking to eventually have the total number of organizations and comments on the dashboard as well.

Thanks!

2 Answers 2

1

Try

SELECT
COUNT(mycolumn) AS d,
COUNT(mycolumn) AS r
FROM
mytable
Sign up to request clarification or add additional context in comments.

3 Comments

why there are 2 identical COUNTs with different aliases?
Unfortunately, this item in Oracle requires two columns
First of them is a display value (alias = "d"), while the second one is a return value (alias = "r").
0

I think you just want count(*):

select count(*)
from contacts;

Presumably, contactID is unique in a table called contacts.

1 Comment

Unfortunately, this item in Oracle requires two columns and a group by function to be used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.