SQL Join question

Mark Smith Mark_Smith at cpe.umanitoba.ca
Mon Jun 23 00:15:45 CEST 2014


Hi Peter, thanks for that. I definitely prefer your option 1. Would it still
be possible to have an auto incrementing field that combines with the device
id to make the primary key (ie. could recno in your example be auto
incrementing)? Also, I wonder if there is a device ID that could be grabbed
from the device itself? Combining the two would make this foolproof since no
manual intervention would be required, and each iPad device would be
guaranteed to have/contribute its own unique id.


Peter Haworth wrote
> Assuming you are using SQLite, there are a couple of ways to achieve this,
> one riskier than the other.
> 
> The less risky approach is to give up on using an autoincrementing primary
> key field and use your own counter along with a device identifier column
> as
> a prefix.  The two columns together would become your primary key column.
>  The CREATE TABLE statement for this would something like:
> 
> CREATE TABLE mytable (Device TEXT DEFAULT 'D1', Recno INTEGER,...other
> columns) PRIMARY KEY (Device,Recno)





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



More information about the use-livecode mailing list