I am a beginner at R. Can someone assist me with how to get the following job done in R.
I have connected my R to redshift(AWS) db and i am performing certain operations on the redshift tables.
From the source table orders i have created a data frame which holds all the possible combinations listing ,how different orders can be placed.I have a id column which list the unique combination (it is jst row number ,since every row holds a unique combination)
data frame which holds the following values:
amt order_time order_day hour_day table_no item_grp id
2 1 2 14 16 1 1
1 2 1 18 12 2 2
In total, the data frame contains 1500 row entries in it.(meant 1500 possible combinations)
I want this data frame to act as a lookup table for sql table name orders which holds the order_id
orders table
order_id amt order_time order_day hour_day table_no item_grp
123 2 1 2 14 16 1
321 2 1 2 14 16 1
456 1 2 1 18 12 2
How can I pass the values in my data frame to a sql statement in where condition Like read every row of my data frame and get the values which satisfy the desired condition from orders table and list the rows in the format speicified below
Output table would look like:
order_id amt order_time order_day hour_day table_no item_grp id
123 2 1 2 14 16 1 1
321 2 1 2 14 16 1 1
456 1 2 1 18 12 2 2
And so on...