Re: SQL join question

2015-05-18 Thread Bob Sneidar
Hi Pete. I’m using mySQL. It *is* a left join, but it assumes INNER and apparently what I wanted was OUTER. I need to read up on these to get an idea of what they are and why they are necessary. All my relational database experience in the past was using Foxpro, which is a somewhat different an

Re: SQL join question

2015-05-15 Thread Peter Haworth
That's strange since the SQLYoga stuff you posted specifies LEFT JOIN. What flavor of SQL are you using? Anyway, you got it working so all good. Pete lcSQL Software Home of lcStackBrowser and SQLiteAdmin

Re: SQL join question

2015-05-15 Thread Bob Sneidar
Thanks Mark just came to that conclusion and then saw your email. Bob S > On May 15, 2015, at 11:14 , Mark Stuart wrote: > > Hi Bob, > LEFT OUTER JOIN will given you every record on the left (devices) even if a > device has no accessory. > > Mark > ___

Re: SQL join question

2015-05-15 Thread Bob Sneidar
OK problem solved. Apparently SQL assumes inner join if not specified. If I define it as an OUTER join, I get all the device records as expected. Thanks for the help. Bob S On May 15, 2015, at 11:07 , Peter Haworth mailto:p...@lcsql.com>> wrote: Hi Bob, Something not right there. A LEFT JOI

SQL join question

2015-05-15 Thread Mark Stuart
Hi Bob, LEFT OUTER JOIN will given you every record on the left (devices) even if a device has no accessory. Mark ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription pr

Re: SQL join question

2015-05-15 Thread Bob Sneidar
Hi Pete. I can post the code that sqlYoga needs for this. I suspect if I wrote out the actual SQL and ran it in a utility, it would work as expected. tableobj_createObject "devices" tableobj_createObject "accessories" tblrelation_createObject "devices|accessories" tblre

Re: SQL join question

2015-05-15 Thread Peter Haworth
Hi Bob, Something not right there. A LEFT JOIN should return all entries from the left table, presumably devices in your example, whether or not there are any matching entries in the other side of the join (accessories). One possibility is that your SELECT statement should name the devices table

SQL join question

2015-05-15 Thread Bob Sneidar
Hi all. I am just now learning SQL joins, and I have run across an interesting caveat. It may be how sqlYoga is working or it may be how joins work. I have two tables, devices and accessories. This is a one to many relationship. I set up the join as a left join on devices.deviceid = accessorie

Re: SQL Join question

2014-07-09 Thread divya navaneeth
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

Re: SQL Join question

2014-07-09 Thread Kay C Lan
On Mon, Jun 23, 2014 at 11:14 AM, Mark Smith wrote: > Thanks Peter. Good discussion. I'll check on the developer list to see if > anyone knows if there is an iPad device ID I can grab. Perhaps another > widget for Monte to work on :) > I know I'm late to the thread (just enjoyed 2 weeks bicycling

Re: SQL Join question

2014-06-22 Thread Mark Smith
Thanks Peter. Good discussion. I'll check on the developer list to see if anyone knows if there is an iPad device ID I can grab. Perhaps another widget for Monte to work on :) -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574p46

Re: SQL Join question

2014-06-22 Thread Glen Bojsza
ed 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 Revolut

Re: SQL Join question

2014-06-22 Thread Peter Haworth
mn. > > 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 mes

Re: SQL Join question

2014-06-22 Thread Mark Smith
must have the same value for all three tables. -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574p4680597.html Sent from the Revolution - User mailing list archive at Nabble.com. ___

Re: SQL Join question

2014-06-22 Thread Mark Smith
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-tp4680574p4

Re: SQL Join question

2014-06-22 Thread Peter Haworth
On Sun, Jun 22, 2014 at 6:55 AM, Mark Smith wrote: > I never did > resolve how to make the primary keys unique across devices > 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 autoincrementi

Re: SQL Join question

2014-06-22 Thread Peter Haworth
file in excel (with an added field indicating which > device the records came from). > > Does this makes sense? > > Mark > > > > -- > View this message in context: > http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574p4680591.html > Sent from th

Re: SQL Join question

2014-06-22 Thread Mark Smith
s this makes sense? Mark -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/SQL-Join-question-tp4680574p4680591.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-li

Re: SQL Join question

2014-06-22 Thread Mark Smith
istinguish 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:

Re: SQL Join question

2014-06-21 Thread Peter Haworth
>> 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 >>

Re: SQL Join question

2014-06-21 Thread Peter Haworth
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.nabbl

Re: SQL Join question

2014-06-21 Thread Peter Haworth
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

Re: SQL Join question

2014-06-21 Thread John Craig
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 _

Re: SQL Join question

2014-06-21 Thread John Craig
atement 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-

SQL Join question

2014-06-21 Thread Mark Smith
://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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage