What I exactly want to do is like this:
- I have two tables, Table 1 has 2 columns A (statements) and column B (userids)
- Table 2 has columns G (username) and H (userids)
Column B and column H hold the same type of data (integer
) but column names are different.
Output: I need to have both the column from table 1 i.e. column A and column B and column G from table 2 based on column H.
Basically, for every statement in table one it has corresponding userids, but usernames are there in table 2. So how can I map it. I know we need to write join here. but the concern is as below
Secondly, the trouble is table 1 is output of a select query . So can we input a select query as table 1 while writing a join?