Joining more than two tables to create a view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2009 06:19 AM
I need some help with a database view. I'm looking to pull together three tables to create a view that I can use like a standard table. I have a couple reference fields that I need to use to dig out fields from those referenced tables. Here's a quick table def:
Table: u_customer_accounts
-------------------------------------
u_id = Number
u_name = string
u_mpf = Reference to u_mpf
u_reportsto = reference to sys_user
Table: u_mpf
----------------
u_id = Number
u_itar = boolean
u_name = String
I would like to create a view that gets all records from u_customer_accounts along with "name" from sys_user and the value of "u_itar" flag from u_mpf. I've created a simple test that can get u_itar from u_mpf, but I cannot seem to get sys_user in to the picture yet.
The funny thing is, I could do this with a SQL statement, but I cannot seem to get it with the Database Views builder. In MySQL it would go something like this:
select u_customer_accounts.u_id,
u_customer_accounts.u_name,
u_mpf.u_name,
u_mpf.u_itar,
sys_user.location,
from
u_customer_accounts,u_mpf,sys_user.location
where
u_customer_accounts.u_mpf=u_mpf.sys_id and
u_customer_accounts.u_reportsto=sys_user.sys_id
This isn't hard, just a learning curve that I can't seem to breach (yet).
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2009 02:12 PM
Not sure this is the issue, but booleans are stored in the database as 0 or 1. Maybe try ca_active=1 ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2009 02:15 PM
CapaJC,
Thanks for the hint. Sadly, it did not pan out. I got this:
Syntax Error or Access Rule Violation detected by database (Unknown column 'task0.active' in 'on clause')