Find Jobs
Hire Freelancers

correct SQL JOIN

$10-30 USD

Completed
Posted over 9 years ago

$10-30 USD

Paid on delivery
This is the SQL-Query: select my011_LAG_Mandant,my011_LAG_MandantOrdner,my011_LAG_Artikelnummer,my011_LAG_Inventurmenge, my011_LAG_res19,my011_LAG_Inventurdatum, my011_LAG_Inventurmenge+sum_bewegung_total from my011_lag_lagerdatei lag inner join my204_tmpfp_formpos on my204_TMPFP_Mandant=my011_LAG_Mandant and my204_TMPFP_MandantOrdner=my011_LAG_MandantOrdner and my204_TMPFP_Artikelnr=my011_LAG_Artikelnummer join ( select slbp.my022_LBP_ID_Lagerartikel, my022_LBP_Datum, SUM(slbp.my022_LBP_Bewegung) AS sum_bewegung_total from my022_lbp_lagerbewegungprot slbp group by slbp.my022_LBP_ID_Lagerartikel ) lbp on lbp.my022_LBP_ID_Lagerartikel=lag.my011_LAG_ID Description: lag (my011_LAG) is the full product table my204_TMPFP is a subset of pruducts, where users put in only these products, which should calculated, so its a filter lbp is a table with all stock movements from products goal is, that << SUM(slbp.my022_LBP_Bewegung) AS sum_bewegung_total >> in JOIN ... should calculate a total sum of stock movements of the linked product. This works fine with the given syntax. Now comes the problem: Total sum should calculated only from movements after a specific stocktaking date, which is stored in my011_LAG_Inventurdatum in lag. So I tried this with a where clause in JOIN: join ( select slbp.my022_LBP_ID_Lagerartikel, my022_LBP_Datum, SUM(slbp.my022_LBP_Bewegung) AS sum_bewegung_total from my022_lbp_lagerbewegungprot slbp where my022_LBP_Datum>lag.my011_LAG_Inventurdatum group by slbp.my022_LBP_ID_Lagerartikel ) lbp on lbp.my022_LBP_ID_Lagerartikel=lag.my011_LAG_ID but this isn't working and I need it solved. It gives the error "lag.my011_LAG_Inventurdatum unknown" whithin the where clause.
Project ID: 6555778

About the project

3 proposals
Remote project
Active 10 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello, SQL is my passion. I'm working in top 10 retail in russia. so I have an experience in SQL The query is ready Regards, Yuriy
$15 USD in 1 day
4.8 (7 reviews)
3.1
3.1

About the client

Flag of AUSTRIA
Sankt Andrae, Austria
5.0
43
Payment method verified
Member since Feb 28, 2008

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.