I Have two SQL's in a preparation.
SQL 1 = A_ID | Age |
SQL 2 = A_ID | Name|
I want to display
A_ID | Age | Name|
I'm okay wither either joining them in the preparation or any other way to get the display to look the way I need it to.
Hey Pedro,
Can you give some extra details on what is exactly your objective?Do you want the output of your SQL to have both the attribute Age and the attribute Name?
Hi,
Just use an aggregate and join it on A_ID.
You don't need two SQL, one aggregate is enough.
https://success.outsystems.com/documentation/11/reference/outsystems_language/data/handling_data/queries/supported_join_types/
Regards,
Daniel
Hi @Pedro Torres,You need to write your query something like below:
SELECT {SQL1}.[A_ID], {SQL1}.[Age], {SQL2}.[Name]FROM {SQL1}INNER JOIN {SQL2} ON {SQL1}.[A_ID]= {SQL2}.[A_ID]
You can call it wherever your bussiness is requiredHope it helps
RegardsN_G
This use case is so simple an aggregate should be used, not an SQL
Hi Pedro Torres,
Just join two or more tables on one Join Condition in Aggregate.
Please check this link for an example.
https://www.outsystems.com/forums/discussion/47830/how-to-join-two-or-more-tables-on-one-join-condition-in-aggregate/
Like join with A_ID
Thanks,
Ramesh
Is there some complication that you haven't mentioned?
If all you want is to get The ID, Age, Name from every record that can be done simply using an aggregate.
The aggregate can be edited to produce the columns in the order you require.
But if this is part of something more complicated where you need to use SQL that is also fairly simple if the age & name are in the same table. You just have to list the 3 things between SELECT & From
SELECT [ID], [Age],[Name] FROM
Your output has to be defined to fit those three items by using the same structure.
Or is there something more complicated that you are trying to do?
Hi Perado,
Try to use the left join you can get this columns that you want
Try to write subqueries in SQL wigdet to get data instead of aggregate.
Thanks & Regards
Reemali.
Hi @Pedro Torres
As I have analysis on your asked question have seen Name and age both are coming from same entity A_ID , why you want to use Two SQLs it can be Done using one only. like this..
Note: You don't need two SQLs , one aggregate/Sql is enough .
---------
IF you have Two Different Entities.!
1.Create a structure for required output.
2.Write the join as given in IMAGE.
3. Test Value as given IMAGE.
Hope you understand
Kind regards
Sourabh
Hi @pedro Torres
Please mark one or more replies as solution, multiple times solutions are provided already.
Kind regards,