Skip to content
Advertisement

SQL query for counting the number of same values in a table and fetching the first value if the count is greater than 1

There is a table such as

I want the number of open-status records and if the number of records are greater than 1, I want to fetch the 1st open status record ID.

for that, I have been trying doing like this

which seems not working (please forgive me if it is a blunder).

I finally want the ID of the first open-status record if only the number of open status records is more than 1.

Advertisement

Answer

you can use a query like this:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement