Skip to main content

Hello,

 

I am attempting to perform multiple left joins using custom SQL, trying to duplicate this result:

 

Multiple Left Joins Syntax for Custom SQL

This works fine, however I need to do this via custom SQL so that I can add in a union of the same data so that each record is duplicated.

 

This is what my SQL looks like now, which returns Database error 0x80004005: Syntax error in JOIN operation:

SELECT

[AssignedBases.Aircraft],

[AssignedBases.Base],

[AssignedBases.Code],

[LocationData.Short Code],

[LocationData.Latitude],

[LocationData.Longitude],

[SortieData.Identifies Aircraft Serial number#] AS [A/C],

[SortieData.Mission Info],

[SortieData.Landing Location],

[SortieData.Identifies Aircraft flying date#] AS [FlyingDate]

FROM

SortieData

LEFT JOIN AssignedBases ON [SortieData.A/C] = [AssignedBases.Aircraft] LEFT JOIN LocationData ON [AssignedBases.Code] =                      [LocationData.Short Code]

LEFT JOIN LocationData ON [SortieData.Landing Location] = [LocationData.Short Code]

 

The error seems to be in my JOIN syntax, but I am not very good in SQL and can't figure it out. Any help is appreciated. Thanks!

12 answers
  1. Mar 1, 2019, 6:12 PM

    Ken,

     

    I read your blog and attempted to implement this, and it did result in the duplication of records like I desired. I don't know if my implementation is correct, but I created a new excel with two columns, link and path, and then populated the path column with 1 and 2 and the link column with "link". I added a link column to the sortie data sheet and did an inner join on link resulting in:

     

    Ken, I read your blog and attempted to implement this, and it did result in the duplication of records like I desired.

    This seems to have accomplished what I wanted, but the problem I see is when I actually and go implement this as a mapping system, I will not have control of the original data source in an excel, it will instead be a HANA database that pulls in flight data automatically. Is there a way to accomplish this directly from the HANA database without adding in the extra column for link? Thanks for your help so far!

0/9000