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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:31:37+00:00 2026-06-13T04:31:37+00:00

Table P_ID I_ID S_ID T_ID Column Column1 — (<Column1> supposed to be <Column>.<Table>-<Column>.<Table1>) Table

  • 0
Table
P_ID   I_ID   S_ID  T_ID Column  Column1



 -- (<Column1> supposed to be <Column>.<Table>-<Column>.<Table1>)


Table

P_ID   I_ID   S_ID  T_ID Column

I ran this query on source table:

select <column> from 
<TABLE>
where 
i_id='<value>';

and i get the output as 9000
then i run this query on target to test id Column1 is getting correct values

select P_ID, I_ID, S_ID, T_ID, 
sum(<column>)
from 
<TABLE> F,<TABLE2> PO
where 
F.P_ID = PO.P_ID
and F.I_ID=PO.I_ID
and F.FLAG='Y'  --something that we need
and T_id>='2012001'  --just for results for 2012
and F.I_id='<Value>'
group by F.P_ID, F.I_ID, F.S_ID, F.T_ID
order by 1;



Here i get Output as
  P_ID     I_ID           S_ID          T_ID           sum(<column>)
 <Value>  <Value>         <Value>      <Value>              18000    
  • 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-13T04:31:39+00:00Added an answer on June 13, 2026 at 4:31 am

    Obviously there are multiple rows in PO for each row in F.

    Also, change your query to the more modern (since 1996!) join syntax:

    from <TABLE> F
    join <TABLE2> PO ON F.P_ID = PO.P_ID and F.I_ID=PO.I_ID
    where F.FLAG='Y'
    ...
    

    Edited:

    If you just want to assert that there is a row in PO (not caring about how many rows) use exists():

    select P_ID, I_ID, S_ID, T_ID, 
    sum(<column>)
    from <TABLE> F
    where exists (
        select * from <TABLE2> PO 
        where F.P_ID = PO.P_ID
        and F.I_ID=PO.I_ID)
    and F.FLAG='Y'  --something that we need
    and T_id>='2012001'  --just for results for 2012
    and F.I_id='<Value>'
    group by F.P_ID, F.I_ID, F.S_ID, F.T_ID
    order by 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run a query like this: insert into table (unique_id, column) select (isnull(max(cast(unique_id
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
So I have two tables students (PK sID) and mentors (PK pID). This query
I've been trying to get this complex MYSQL query to work exactly right over
The following code is a section of one of my classes: $stmt = $this->dbh->prepare(SELECT
I wanna create table in database with column of type date. But I can't
I am trying to build a Linq to Entities query that joins a table
I can't see what is wrong with this query. I get an error saying:
I am having a problem with the following query(if this is a duplicate question
With the following query: SELECT p.*, i.*, GROUP_CONCAT(DISTINCT(pc.category_id)) AS post_categories, GROUP_CONCAT(DISTINCT(pt.tag_id)) AS post_tags FROM

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.