You are here: Re: [newbie] sql : simple select question « PHP SQL « IT news, forums, messages
Re: [newbie] sql : simple select question

Posted by Johnny on 10/07/99 11:59

"Johnny" <removethis.huuanito@hotmail.com> wrote in message
news:YTTSg.465$UJ2.42@fed1read07...
>
> "Johnny" <removethis.huuanito@hotmail.com> wrote in message
> news:MATSg.464$UJ2.159@fed1read07...
> >
> > "Tony Louazι" <tlouaze@noos.fr> wrote in message
> > news:451bbcfc$0$17446$79c14f64@nan-newsreader-07.noos.net...
> > > Hi, My SQL lessons are very far :(
> > >
> > > CREATE TABLE CONTACTS
> > > (ID INT,
> > > NAME VARCHAR(10)
> > > PHONE VARCHAR(10))
> > >
> > > CREATE TABLE CLASS
> > > (CONTACT INT,
> > > CAT INT)
> > >
> > > INSERT INTO CONTACTS VALUES (101, 'toto', '3545')
> > > INSERT INTO CONTACTS VALUES (102, 'pif', '8421')
> > > INSERT INTO CONTACTS VALUES (103, 'loulou', '1245')
> > >
> > > INSERT INTO CLASS VALUES (101, 1)
> > > INSERT INTO CLASS VALUES (101, 2)
> > > INSERT INTO CLASS VALUES (102, 1)
> > >
> > > toto owns to category 1 and 2
> > > pif owns to category 1
> > > loulou owns to none categories
> > >
> > > => how can I display contacts who own to none categories (like loulou)
?
> > >
> > > I tried:
> > > SELECT * FROM contacts LEFT OUTER JOIN class ON id = contact
> > > I get the list of all contacts...
> > > but if I add 'WHERE cat = NULL' : there's no result :(
> > >
> > > Thanx for your help !
> > >
> > >
> >
> > isn't that what you'd expect? there don't seem to be any null cats in
what
> > you show....
> >
> >
>
> oops! not enough coffee yet! wait one :-)
>

try
IS NULL
in place of
= NULL

testing for null is a special case

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация