[HACKERS] Re: [SQL] LEFT JOIN ...

2001-06-18 Thread The Hermit Hacker
Perfect, thank you ... i knew I was overlooking something obvious ... the query just flies now ... On Mon, 18 Jun 2001, Tom Lane wrote: > The Hermit Hacker <[EMAIL PROTECTED]> writes: > >> Try adding ... AND n.nid = 15748 ... to the WHERE. > > > n.nid is the note id ... nl.id is the contact id

[HACKERS] Re: [SQL] LEFT JOIN ...

2001-06-18 Thread Tom Lane
The Hermit Hacker <[EMAIL PROTECTED]> writes: >> Try adding ... AND n.nid = 15748 ... to the WHERE. > n.nid is the note id ... nl.id is the contact id ... Ooops, I misread "n.nid = nl.nid" as "n.nid = nl.id". Sorry for the bogus advice. Try rephrasing as FROM (note_links nl JOIN notes n ON (

[HACKERS] Re: [SQL] LEFT JOIN ...

2001-06-18 Thread The Hermit Hacker
On Mon, 18 Jun 2001, Tom Lane wrote: > The Hermit Hacker <[EMAIL PROTECTED]> writes: > > FROM note_links nl, notes n LEFT JOIN calendar c ON (n.nid = c.nid) > > WHERE (n.type = 'A' OR n.type = 'N' OR n.type = 'H' OR n.type = 'C') > > AND (nl.id = 15748 AND contact_lvl = 'c

[HACKERS] Re: [SQL] LEFT JOIN ...

2001-06-18 Thread Stephan Szabo
I think that using INNER JOIN between nl and n (on n.nid=nl.nid) or joining those tables in a subquery might work. On Mon, 18 Jun 2001, The Hermit Hacker wrote: > Is there some way to write the above so that it evaluates: > > WHERE (n.type = 'A' OR n.type = 'N' OR n.type = 'H' OR n.ty

[HACKERS] Re: [SQL] LEFT JOIN ...

2001-06-18 Thread Tom Lane
The Hermit Hacker <[EMAIL PROTECTED]> writes: > FROM note_links nl, notes n LEFT JOIN calendar c ON (n.nid = c.nid) > WHERE (n.type = 'A' OR n.type = 'N' OR n.type = 'H' OR n.type = 'C') > AND (nl.id = 15748 AND contact_lvl = 'company') > AND n.nid = nl.nid >