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 8106277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:25:16+00:00 2026-06-06T00:25:16+00:00

I hace sql query through this i want to calculate the records after 05:00:00

  • 0

I hace sql query through this i want to calculate the records after 05:00:00 PM and before
05:00:00 PM.Here i smy query but through this i am getting wrong results please any one check this if any logical error in this

Select trunc(gross_weight_date) date1,
count(*) before5 
from wbg.WBG_01_01
where to_char(gross_weight_date,'HH:MI:SS PM')>'05:00:00 PM'
and item_cod = 16
and trunc(gross_weight_date)='05-JAN-2012' 
group by trunc(gross_weight_date)
order by date1

Any help may apprecaited

  • 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-06-06T00:25:18+00:00Added an answer on June 6, 2026 at 12:25 am

    You are using chars to compare dates. That won’t work properly.


    Since you only want to compare after 05 PM, here’s an easier solution:

    Select trunc(gross_weight_date) date1,
    count(*) before5 
    from wbg.WBG_01_01
    where to_number(to_char(gross_weight_date, 'HH24MISS')) > 150000
    and item_cod = 16
    and trunc(gross_weight_date)='05-JAN-2012' 
    group by trunc(gross_weight_date)
    order by date1
    

    It passes the value of the date to a char (‘171212’) and then to a number (171212) and compares it to 150000.

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

Sidebar

Related Questions

I am just getting into xslt transformation and after going through a tutorial I
I'm trying to parse a web page, but when I want to get a
I know this question has been asked a lot of times, but so far,
I have a Django applciation running on Apache with mod_wsgi, but I would like
I'm still learning Bash and I'm having a problem with my script. I want
I try to paste a PHP $value to the JavaScript to show it but
Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision. Running
I'm just stuck with a problem (maybe Simple). But I can't figure out how
We need to make a connection to ms sql server from java persistence unit
I hace attached my device to the PC and run my service via Eclipse

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.