‎2019 Apr 03 4:10 PM
Hello, I would like to do a Left Outer Join in the WHERE statement (Selection Formula Record). Any suggestions would be utmost appreciated. I know we should do this in the FROM statement, but I do not have a field to LOJ to at that point. It's one field, all the rest LOJ's work great in the FROM statement.
‎2019 Apr 03 10:16 PM
"Selection Formula Record" is not a generic SQL language concept (a quick google search suggests it may be a Crystal Reports concept, you may want to add an 'SAP Crystal Reports' tag to your post if that is indeed what you are using.).
Sounds like it is a structure with multiple values packed into a single column. It would be helpful if you can explain what it looks like, perhaps give a detailed example. How can you recognize the boundaries between values in the SFR? Perhaps you can join against a substring of the SFR value?
‎2023 Dec 19 9:41 AM
It's generally not possible to perform a Left Outer Join in the WHERE clause directly. The WHERE clause is primarily used for filtering data based on conditions.
Left Outer Joins are typically specified in the FROM clause. If you don't have a field to join in the FROM clause, you might want to reevaluate your data model or query structure.
However, if you need to simulate a Left Outer Join in the WHERE clause, you could use something like:
SELECT *
FROM table1
LEFT JOIN table2 ON table1.id = table2.id
WHERE table2.id IS NULL;
This query selects all records from table1 and includes matching records from table2. The WHERE clause then filters out the records where there is no match in table2, effectively simulating a Left Outer Join.
Keep in mind that this approach might not be as efficient as specifying the join conditions in the FROM clause, and it's essential to consider the performance implications, especially with large datasets.