SQL Join question

John Craig john at splash21.com
Sat Jun 21 11:56:51 EDT 2014


What database are you using?  The following should work with MySL (and 
maybe others)

If tableA was empty or both tables didn't have any overlapping primary 
key values, then this would work, but I'm assuming there's a primary key 
in there that would mess things up.
INSERT INTO tableA SELECT * FROM tableB

If you have an auto incrementing primary key 'id' as the first field in 
both tables...
INSERT INTO tableA SELECT 0, field1, field2, field3, etc...  FROM tableB

If you want to overwrite any conflicting records in tableA with the 
records from tableB...
REPLACE INTO tableA SELECT * FROM tableB

HTH


On 21/06/2014 15:57, Mark Smith 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