SQL Join question

Mark Smith Mark_Smith at cpe.umanitoba.ca
Sun Jun 22 15:55:43 CEST 2014


John Craig-4 wrote
> I really should have started with '0, field2' in the example below - 
> assuming field 1 is the primary key..
>> 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
>>

Hi John, good guess on field1 being an auto incrementing primary key. If you
don't mind me asking,what does the leading '0' in your insert statement
select?

This discussion btw, reminds me that I have another problem. We started out
in a pilot collecting data on one iPad when the volume increased to the
point where a second unit was required. There are 3 tables in the database
and they are all linked on the auto incrementing primary key in table 1 (ie.
table 1 holds the primary key that links all 3 tables). With 2 iPads in the
field I now have duplicate primary keys (1 set on each iPad). I never did
resolve how to make the primary keys unique across devices and would welcome
suggestions on how to do that. At present what I think I will do is just
export these files into excel and add a column with a device name to
distinguish the two sets and then combine then into 1 set of files (using
excel, or cut and past… total volumes are actually quite low it just took
time to enter the data which is why they ended up needing two iPads).  

Thanks for the advice

Mark



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574p4680590.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list