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

  • Home
  • SEARCH
  • 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 6162657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:41:27+00:00 2026-05-23T21:41:27+00:00

WITH abc AS ( SELECT p_id , t1.amount as amount , SUM(amount) OVER (PARTITION

  • 0
WITH abc AS
(     
    SELECT p_id    
        ,  t1.amount as amount
        ,  SUM(amount) OVER (PARTITION BY '|| pqr_rec.p_type ||' ) AS sum_amount
    FROM  table1 t1, temp_table tt1t
    WHERE t1.activity_type = 'pqr_rec.p_activity_type'
)     
SELECT p_id
    ,  sum_amount
    ,  amount
FROM abc
WHERE sum_amount > '||pqr_rec.p_amount

t2 Table:

xyz_id                p_type          p_amount             p_activity_type
============================================================================
p_1                 p_id,date                100000             sell

t1 Table:

T_id            p_id    amount    date                    p_activity_type
=====================================================================
1               E1      100       1984-10-27 00:02:00       sell
2               E1      200       1984-10-27 00:04:00       sell
3               E1      200       1984-10-27 00:05:00       sell
4               E1      300       1984-10-27 00:06:00       sell
5               E1      100       1984-10-27 00:07:00       sell

Now here the table t2 1st record is been fetched by a cursor pqr and the above query is run ,so the partition by is done on the basis of p_id and date ,but the issue is the the date contains timestamp ,so the group by is not working .I need to do group by on the basis of date without timestamp .

How can we handle this situtaion.
I am using ORACLE

  • 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-23T21:41:28+00:00Added an answer on May 23, 2026 at 9:41 pm

    You could create a view that has the date truncated:

    create view t1_trunc_date as
    select p_id, trunc(date) as date, ...
    from table1;
    

    Then use that instead of t1 in the main query.

    Or an in-line view if you prefer:

    WITH abc AS
    (     
        SELECT p_id    
            ,  t1.amount as amount
            ,  SUM(amount) OVER (PARTITION BY '|| pqr_rec.p_type ||' ) AS sum_amount
        FROM  (select p_id, trunc(date) as date, ...
               from table1) t1
            , temp_table tt1t
        WHERE t1.activity_type = 'pqr_rec.p_activity_type'
    )  
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT MAX(date) FROM abc WHERE p_id=p_p_id AND nvl(c_number,0)=nvl(p_c_number,0) AND nvl(m_number,0)=nvl(p_m_number,0) AND nvl(s_number,0)=nvl(p_s_number,0); In the
I am doing Query query = hibernate.createSQLQuery(select abc,def from table); Is it possible to
In Postgre, why does select abc from (select 1) as abc produces: (1) and
Example: result = ActiveRecord::Base.connection.execute(select 'ABC') How can I get the 'ABC' value from result
On Oracle 9i, why does the following produce the result 'abc' select 'abc '
function abc() { document.form1.1.disabled=true; } I have a select box whose id is 1
table 'abc' data : tid title 1 வெள்ளிக்கிழமை ஐ. 2 கோலாகல தொடக்க $sql=mysql_query(select title
I'm running a select that returns alphanumeric results, e.g: ABC-1 ABC-2 ABC-10 SAM-1 SAM-2
(LocalVariable)ABC.string(Name) = (IDataReader)dataReader.GetString(0); This name value is coming from database. What happening here is
Suppose I have a table abc with columns p_id , u_id , and comments

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.