SQL Join question

Peter Haworth pete at lcsql.com
Sat Jun 21 12:04:06 EDT 2014


SELECT * FROM TableA UNION SELECT * FROM TableB

Both tables must have the same number of columns. You'll end up with
separate Records from each table so if you need to differentiate between
them and there isn't a column that does that, you could do something like

SELECT 'A',* FROM tableA UNION SELECT 'B',* FROM tableB

You'll probably need to sort the Records so the related entries appear
together assuming the two tables each have a column that relate them to
each other.

If there is a column that ties the tables together then

SELECT tableA.*,tableB.* FROM tableA JOIN tableB ON
tableB.keycolumn=tableA.keycolumn

Pete
lcSQL Software
On Jun 21, 2014 7:57 AM, "Mark Smith" <Mark_Smith at cpe.umanitoba.ca> wrote:

> I have two tables A and B, both with the same structure (about 50 columns
> each). I would like to combine them into a single table (ie. rows from
> Table
> A followed by rows from Table B). Does anyone know of an SQL statement that
> will do that?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list