|
|
|
|
![]() ![]() |
Aug 16 2007, 01:40 PM
Post
#1
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 21 Joined: 15-August 07 Member No.: 48,203 |
hi there,
im working on a performance request system, and i have three tables that im working with right now. the performances table holds the info about the performance (date, times, status, etc.), and has two columns, org_type and org_id, which both hold an int value to tell me where the organization info is. there are two org types which have respective tables, because we collect different information based on the type of org that is registering. is there any way to select info from all three tables (dynamically selecting between the two org tables based on org_type, then selecting the proper org info based on org_id) in one query? what im using: mysql 5.0, MyISAM tables php 5.2 |
|
|
|
Oct 11 2007, 04:14 PM
Post
#2
|
|
|
Newbie [Level 1] ![]() Group: [HOSTED] Posts: 21 Joined: 29-September 07 Member No.: 50,836 |
Yes there is away to select info from mutiple tables out your database. This is the way:
CODE SELECT p.date, p.time, o.name, o.blabla FROM `preformance` AS p AND `organization` AS o WHERE o.id = p.org_id; or CODE SELECT preformance.date, preformance.time, organization.name, organization.blabla FROM `preformance` AND `organization` WHERE organization.id = preformance.org_id; But as you can see the first method is way more efficient. Good luck with it |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 30th August 2008 - 02:17 AM |