Union query in aware IM like mysql

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Union query in aware IM like mysql

Post by swiftinitpvtltd »

SELECT
timestamp, amount, username
FROM
transaction1
UNION SELECT
timestamp, amount, username
FROM
transaction2
ORDER BY timestamp;

How do I achieve this in aware Im to combine 2 tables into single grid? In stored procedure I get data via union but I am not able to see user or shortcut columns(exist in these 2 BO's) in mysql tables. User_RID shows up but returns error in query.
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Union query in aware IM like mysql

Post by PointsWell »

To get the Shortcut details you’d need to join to the tables with the shortcut data.

AIM is doing the heavy lifting for you via shortcuts but if you use a stored procedure you need to do all the selects yourself. (You might get away with not having to do explicit selects for the shortcuts if you put the results into an already existing BO - this is a guess I have tested exotic SPs into existing BOs)

It’s hard to tell what you are trying to achieve from transaction 1&2 BOs.

Are Transaction 1 and Transaction 2 a recursive relationship to themselves?
himanshu
Posts: 723
Joined: Thu Jun 19, 2008 6:24 am
Location: India
Contact:

Re: Union query in aware IM like mysql

Post by himanshu »

User Business Object Groups
From,
Himanshu Jain


AwareIM Consultant (since version 4.0)
OS: Windows 10.0, Mac
DB: MYSQL, MSSQL
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: Union query in aware IM like mysql

Post by swiftinitpvtltd »

Thank you!
There is no fix relationship except both store same type of data but at different times and one column type has different data (UserType transaction vs financial transaction in these 2 tables). As its large data we are using different tables to distinguish user actions vs other actions. I want to combine these tables for display purpose as thats one requirement and now I do not want to create another BO for storing both in single BO and display so I need union.
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Union query in aware IM like mysql

Post by Jaymer »

The union of two or more tables is exactly what happens when you are using business object GROUP.
( You can see union in the SQL code when you look behind the scenes at operations involving BO groups. )
Just make a group over the top of both of those tables, and query using that new BO.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply