Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:07:53+00:00 2026-05-22T19:07:53+00:00

I have to do counts to the quantity of entitys in the database i

  • 0

I have to do counts to the quantity of entitys in the database i have to obtain the quantity of registries for entities that appear

ENTITY OVERALL DATE HOUR
====== ===== ==== ====
ENT1 5 20100318 12:00
ENT2 20 20100318 12:00
ENT3 12 20100318 12:00

CURSOR1
SELECT distinct(rp.cod_entidad),
YYYYYYYYY,
to_date(to_char(SYSDATE,'YYYYMMDD'),'YYYY-MM-DD') as fecha_pago,
to_char(sysdate,'hh-mi-ss') as hora_pago
FROM registry rp, product pc
where pc.nro_solicitud = rp.nro_solicitud
and pc.resp_2= 'OK'
and pc.resp_1= 'OK'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:07:54+00:00Added an answer on May 22, 2026 at 7:07 pm

    Use a GROUP BY on the column that you want to be unique.
    In order for PL-SQL to not complain you’ll have to use an aggregate function that will select a value for the other columns.
    I’ve picked MAX(), but MIN() or the non-existent whatever() will do just as well.

    SELECT 
      rp.cod_entidad,
      count(*) as rowcount,   -- number of rows per distinct rp.cod_entidad
      MAX(to_date(to_char(SYSDATE,'YYYYMMDD'),'YYYY-MM-DD')) as fecha_pago,
      MAX(to_char(sysdate,'hh-mi-ss')) as hora_pago
    FROM registry rp
    INNER JOIN product pc ON (pc.nro_solicitud = rp.nro_solicitud)
    WHERE pc.resp_2 = 'OK' AND pc.resp_1 = 'OK'
    GROUP BY rp.cod_entidad
    

    Implicit where join considered harmful
    P.S. please don’t use that ugly implicit where join, it is confusing and bad practise, because you are mixing selection criteria with join criteria in your where clause for no reason whatsoever.
    We’ve had explicit join syntax since 1993, I warmly recommend it.
    It will make writing correct queries much much easier and it will make your intentions clearer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that counts the characters in each of my comments, excluding
I have a counter that counts up every 1 second and add 1 to
I have a part of a code that counts what is in the x,y
I have a function (frequency) which that counts how many times each distinct value
For example I have an app that counts how many time Camera button was
I have a database with some columns named UPC title Description and Quantity. i
I have a query that involves searching database over a range of 30 days.
I have a query returning the counts of some data, but I do NOT
i have a query in access that is this: SELECT iif([Cup Type] like '*Cylinder*',count([Cup
I have a table, Sheet1$ that contains 616 records. I have another table, Rates$

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.