Hi Rudy.. I mean everyone ;-p
i've two tables:
JobType
id (int)
name (varChar)
Jobs
id (int)
user (int)
week (date)
day (int)
jobNo (int)
jobType (int)
hours (int)
I want to list all job types, and IF there's any corresponding with
the jobs table, I want to marry them up.
I've used this:
HERE's my SQL dump...
CREATE TABLE `jobType` (
`id` int(12) NOT NULL auto_increment,
`name` varchar(100) collate utf8_bin NOT NULL default '',
`type` tinyint(10) NOT NULL default '0',
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ;
--
-- Dumping data
I've googled OUTER joins, but Im getting errors...?? Hm
funny, google never gave me any errors, and i've been using it since it came
out
what you want, young paduan, is a LEFT OUTER JOIN instead
;o)
� The WDVL Discussion List from WDVL.COM �
To Join wdvltalk, Send An Email
Rudy, I knew you'd be there somewhere ;-p
it's odd... I'd tried that, and just got one row of results.
Still do...
It's going through the jobs table and only returning jobTypes that
have been flagged in jobs..
not ALL job types...
any other ideas?
On 04/04/07, r937 [EMAIL PROTECTED] wrote:
my bad, i meant padawan, not paduan
see http://en.wikipedia.org/wiki/Padawan#Jedi_ranks
;o)
� The WDVL Discussion List from WDVL.COM �
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
It's going through the jobs table and only returning jobTypes that
have been flagged in jobs..
not ALL job types...
i tested the LEFT OUTER JOIN on the data you supplied and it works
~fabulously~
maybe you have some other conditions that are clouding the issue
� The WDVL Discussion
Ah, i'm on 4.1.11
that make a difference?
On 04/04/07, r937 [EMAIL PROTECTED] wrote:
It's going through the jobs table and only returning jobTypes that
have been flagged in jobs..
not ALL job types...
i tested the LEFT OUTER JOIN on the data you supplied and it works
~fabulously~
maybe
Ah, i'm on 4.1.11
that make a difference?
none whatsoever
;o)
� The WDVL Discussion List from WDVL.COM �
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To:
:-(
Here I go again...
it really doesn't work... ? :-(
SELECT jobType.name, jobs.user, jobs.jobNo, jobs.jobType, jobs.hours, jobs.day
FROM jobType
LEFT OUTER JOIN jobs ON jobs.jobType = jobType.id
WHERE jobs.id IS NULL
OR (
jobs.user = '4'
AND jobs.week = '2007-03-19'
AND (
jobs.day = '3'
OR
Here I go again...
it really doesn't work... ? :-(
yes it does, but you have to be really careful with WHERE conditions in
outer joins
SELECT jobType.name, jobs.user, jobs.jobNo, jobs.jobType, jobs.hours,
jobs.day
FROM jobType
LEFT OUTER JOIN jobs ON jobs.jobType = jobType.id
WHERE jobs.id
OHHH!!!
Makes sence...
Cheers Rudy... as ALWAYS!!!
(I'd kiss you, but that'd be a bit too fruity for my taste... not that
there's anything wrong with that!)
On 04/04/07, r937 [EMAIL PROTECTED] wrote:
Here I go again...
it really doesn't work... ? :-(
yes it does, but you have to be really
11 matches
Mail list logo