Обсуждение: Still stuck on a left join

Поиск
Список
Период
Сортировка

Still stuck on a left join

От
"Ari Nepon"
Дата:
I've been stuck now on a left join for about two weeks. DB is MSaccess2K,
language is ASP. I'm learning php and PgSQL now, and will be migrating
everything soon. In the mean time. If anyone knows where I am going wrong,
please let me know.

Here is my current SQL query:
SELECT T.ID, T.employee, T.task, T.description, T.hours_used, T.f_date,
P.project_name, C.name
FROM  track AS T LEFT JOIN project AS P ON  (T.project=P.project_id)  LEFT
JOIN clients AS C ON (T.client=C.ID)
WHERE T.client LIKE '%MMColParam%'

Here is the error I get:[Microsoft][ODBC Microsoft Access Driver] Syntax
error (missing operator) in query expression '(T.project=P.project_id) LEFT
JOIN clients AS C ON (T.client=C.ID)'

My DB structure:

I have 5 tables: clients,project,tasks,track,users

rows are as follows:

clients.ID,clients.name
project.project_id,client_id,project_name
tasks.TaskID,tasks.Task_Name
track.ID,track.employee,track.client,track.project,track.task,track.descript
ion,track.hours_used,trck.f_date
users.c_username,users.c_password

Anyone know where I am going wrong?

Thanks,
Ari

~~~~~~~~~~~~~~~~~~~~~~~~~
Ari Nepon
MRB Communications
4520 Wilde Street, Ste. 2
Philadelphia, PA 19127
p: 215.508.4920
f: 215.508.4590
http://www.mrbcomm.com

-----------------------------------------------------------------------
Sign up for our email list and receive free information about
topics of interest to nonprofit communications, marketing, and
community building professionals. Free resources, articles, tips.
Go to http://www.mrbcomm.com and use the Mailing List form.
-----------------------------------------------------------------------



Re: Still stuck on a left join

От
"Josh Berkus"
Дата:
Ari,

> I've been stuck now on a left join for about two weeks. DB is
> MSaccess2K,
> language is ASP. I'm learning php and PgSQL now, and will be
> migrating
> everything soon. In the mean time. If anyone knows where I am going
> wrong,
> please let me know.

Shame on you!

Seriously, you'd probably spend less time learning how to use PostgreSQL
than on getting around Access2k's "features."

One of these "features" is a fussy query optimizer that frequently
rejects perfectly valid query strings.  This is why I charge my clients
$40/hour more to work with Access2k.

Try monkeying with the parentheses in the JOIN expression:

(a LEFT OUTER JOIN b ON a.1 = b.1) LEFT OUTER JOIN c ON b.2 = c.1

.. may work, where ...

a LEFT OUTER JOIN b ON a.1 = b.1 LEFT OUTER JOIN c ON b.2 = c.1

... does not.

Also try it without aliasing the tables.

If you need further help with MS Access, give me a call ... but I charge
hourly for Microsoft stuff!

-Josh

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco