I have two tables, one is a table #1
contains user information, email, password, etc..
the other table #2 contains item information
when I do a insert into table #2
, and then use the returning statement, to gather what was inserted (returning auto values as well as other information), I also need to return information from table #1
.
(excuse the syntax)
example:
insert into table #1(item,user) values('this item','the user')
returning *, select * from table 2 where table #1.user = table #2.user)
in other words, after the insert I need to return the values inserted, as well as the information about the user who inserted the data.
is this possible to do?
the only thing I came up with is using a whole bunch of subquery statements in the returning clause. there has to be a better way.