Skip to content

Tag: left-join

Combining sql queries together

I am trying to simplify my current query code. Is there a simpler way of combining both queries into one? Here is what I have tried so far. Although it seems really messy and clunky. This query …

JOIN ON either of the two columns but not both

I have two tables (orders, agents) i’m trying to join on either of the two columns but not both. There are some records in orders that have both of these columns populated and it returns as duplicate orders: agents: I tried joining with an OR clause I’m getting the following results Expected Resul…

How to joins in oracle based on condition

I have two tables as below: Table Apple: Table KEEY: Desired Output: Code Tried So far: This is giving me : I guess i need to use pivot instead of Union to get both the ids on same row. Have you ever encountered such scenarios? Any pointers to proceed will be very helpful. Thanks in Advance! DDL used for the