Re: Newbie LEFT JOIN question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is the P H P list not the S Q L list. I mean really, your question
isn't even worded as a PHP question. Maybe if you add a few echos or a
variable here and there someone here might let it pass. But just asking
a plain old SQL question is not the purpose of the P H P list.

Cheers,
Rob.

On Wed, 2005-03-09 at 00:50, Jackson Linux wrote:
> Hi, all,
> I have three tables; 'cv', the main table, 'jobcat', a definition table 
> and 'cvjobcats',  an intersection table (for more detail see PS below).
> 
> I'd like to join this all together to be able to make a headline 
> consisting of the plain English description of the job category 
> followed by all rows within cv which contain a reference to that job 
> category
> 
> I can follow this only to a point and that is where I ask for the 
> List's help - does this even resemble the beginnings of what I want to 
> accomplish? I've tried to comment as I go for my own sanity
> 
> 
> //Select columns from 'cv', whose 'category' references numbers
> //Select 'category' from 'jobcat' to translate the numbers to English
> 
> "SELECT cv.cv_id,
>   	cv.category,
> 	dates,
> 	cv.job_title,
> 	cv.company,
> 	cv.job,
>  	jobcat.category
> 
> FROM cv
> LEFT JOIN cvjobcats
>  ON cvjobcats.cv=cv.cv_id //Let tables cv and jobcat understand each 
> other.
> 
> //This next bit I'm confused about
> LEFT JOIN jobcat
>  ON jobcat.jobcat_id=cvjobcats.jobcat
> WHERE
>  cvjobcats.jobcat='4'";
> 
> 
> Great. I'm now lost. Can anyone advise?
> 
> Thanks in advance,
> 
> 
> PS:
>   <far too much information>
> cv contains columns including an primary key ('cv_id') and a column 
> called 'category' which refers to job categories by number.
> 
> jobcat contains two fields: a primary key (jobcat_id) and a plain 
> english description
> 
> cvjobcat contains two key columns: 'cv_id' and 'jobcat_id'.
> </far too much information>
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux