joining data from two tables

September 13, 2012 at 03:00:30
Specs: Windows 7
select el_nodes.name AS NewName, parameter as newParameter, value AS new_value from el_node_params
left join el_nodes on
el_nodes.nodeversionid = el_node_params.nodeversionid
left join el_stream_versions on
el_nodes.streamversionid = el_stream_versions.streamversionid
where
el_stream_versions.streamid=230 and el_stream_versions.streamversion=49;


select el_nodes.name as OldName, parameter as oldParameter, value AS old_value from el_node_params
left join el_nodes on
el_nodes.nodeversionid = el_node_params.nodeversionid
left join el_stream_versions on
el_nodes.streamversionid = el_stream_versions.streamversionid
where
el_stream_versions.streamid=230 and el_stream_versions.streamversion=48;


i need output as NewName,oldName,newParameter,OldParameter, new_Value, old_value.


Also exception can be that old fields might not exist so we need to put NULL in case of such activity. Can anyone help me and assist me with my query.



See More: joining data from two tables

Report •

#1
September 13, 2012 at 08:17:45
I don't know what database you are using so I won't get into syntax. I would read the OLD query into a tmp table - call it OLDTMP.

I would also read the new query into another tmp table - call it NEWTMP. I would also include the streamid column in the tmp tables because that is what will be used to link the tables together in another select.

Now, you should be able to select all the TMP table columns


Report •
Related Solutions


Ask Question