[This post is an archive from old SQL Yoga forums]
Hello Trevor,
Its been a while since I last touched SQL Yoga. I've been using an old release and its working quite well. Today I begun a new project here on the company I am working for. A simple tool to query our own database. That database is quite big and there are many table relationships thru foreign keys and the like.
I don't know how to work them out with SQL Yoga. When I create a query object, I wish to query the main table and also obtain some information from the other related tables. I tried using the "joins" property of a query object but it didn't work, when I activate the log, I see the join is not even there.
Can you put some examples showing how to use query objects to get stuff from more than one table? In my case, the table is full of things like Id_Product, Id_Category which are all primary keys to other tables with the same field names... I just want to get for example product name from that table.
Thanks
Example of Table Relationships
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller, trevordevore
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Example of Table Relationships
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Example of Table Relationships
[This post is an archive from old previous SQL Yoga forums]
Andre,
It looks like there is a bug when setting the "joins" property if you haven't defined any table relationships yet. I will get that fixed but joins in SQL Yoga (Query or Record objects) work best if you have defined table relationships.
I'm on vacation this week so I won't be adding any new lessons until I get back but there are examples of defining table relationships in the example docs:
http://revolution.screenstepslive.com/s ... ationships
http://revolution.screenstepslive.com/s ... pe-Objects
I do hope to automate the generation of relationships at some point based on the relationships defined in the db schema.
Andre,
It looks like there is a bug when setting the "joins" property if you haven't defined any table relationships yet. I will get that fixed but joins in SQL Yoga (Query or Record objects) work best if you have defined table relationships.
I'm on vacation this week so I won't be adding any new lessons until I get back but there are examples of defining table relationships in the example docs:
http://revolution.screenstepslive.com/s ... ationships
http://revolution.screenstepslive.com/s ... pe-Objects
I do hope to automate the generation of relationships at some point based on the relationships defined in the db schema.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Example of Table Relationships
I've fixed the "joins" issue so that SQL Yoga will properly parse "related table joins" even if Relationship Objects have not been defined. This will be included in 1.0.1 build 6. If you want a copy email me and I will get you a copy.
I've started a chapter in the main manual that discusses Relationships. I have posted a few lessons so far and am working on some others.
http://revolution.screenstepslive.com/s ... ls/sqlyoga
I've started a chapter in the main manual that discusses Relationships. I have posted a few lessons so far and am working on some others.
http://revolution.screenstepslive.com/s ... ls/sqlyoga
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder