NYCPHP Meetup

NYPHP.org

[nycphp-talk] had to give you guys a break

Jim Hendricks jim at bizcomputinginc.com
Fri Sep 12 17:07:35 EDT 2003


(+)= is not valid ANSI SQL, it's Oracle SQL you need to use join syntax.

   $sql = 'SELECT v.nnet_produkt_varegruppe_navn, ' .
          '       f.nnet_produkt_farge_navn, ' .
          '       s.nnet_produkt_storrelse_navn, ' .
          '       k.nnet_produkt_kvalitet_navn, ' .
          '       p.* ' .
          'FROM nnet_produkt p ' .
          '  JOIN nnet_produkt_varegruppe v ON p.nnet_produkt_varegruppe_code = v.nnet_produkt_varegruppe_code ' .
          '  JOIN whatevertable_is_f f ON p.nnet_produkt_farge_code = f.nnet_produkt_farge_code ' .
          '  LEFT JOIN nnet_produkt_storrelse s ON p.nnet_produkt_storrelse_id = s.nnet_produkt_storrelse_id ' .
          '  LEFT JOIN nnet_produkt_kvalitet k ON p.nnet_produkt_kvalitet_id = k.nnet_produkt_kvalitet_id '

I Forget the Oracle syntax so if this is suppose to be a right join, just replace LEFT with RIGHT.

Jim
______________________________________________________________
Jim Hendricks, President, Biz Computing, Inc
Phone:  (201) 599-9380     Email: jim at bizcomputinginc.com
Web: www.bizcomputinginc.com 
Snail:  Jim Hendricks,  Biz Computing, Inc.,  255 McKinley Ave, New Milford, NJ 07646
______________________________________________________________

______________________________________________________________
Jim Hendricks, President, Biz Computing, Inc
Phone:  (201) 599-9380     Email: jim at bizcomputinginc.com
Web: www.bizcomputinginc.com 
Snail:  Jim Hendricks,  Biz Computing, Inc.,  255 McKinley Ave, New Milford, NJ 07646
______________________________________________________________

  ----- Original Message ----- 
  From: Phil Powell 
  To: NYPHP Talk 
  Sent: Friday, September 12, 2003 4:27 PM
  Subject: [nycphp-talk] had to give you guys a break


  I'm not kidding, the only reason yesterday you didn't hear from me was because I wasn't coding, but today I am doing something quick, and yes, as always it failed.. right at the SQL statement:


     $sql = 'SELECT v.nnet_produkt_varegruppe_navn, ' .
            '       f.nnet_produkt_farge_navn, ' .
            '       s.nnet_produkt_storrelse_navn, ' .
            '       k.nnet_produkt_kvalitet_navn, ' .
            '       p.* ' .
            'FROM nnet_produkt p, nnet_produkt_varegruppe v, ' .
            '     nnet_produkt_kvalitet k, nnet_produkt_storrelse s ' .
            'WHERE p.nnet_produkt_varegruppe_code = v.nnet_produkt_varegruppe_code ' .
            ' AND p.nnet_produkt_farge_code = f.nnet_produkt_farge_code ' .
            ' AND p.nnet_produkt_storrelse_id (+) = s.nnet_produkt_storrelse_id ' .
            ' AND p.nnet_produkt_kvalitet_id (+) = k.nnet_produkt_kvalitet_id';

  I am getting "invalid SQL near (+).  That is totally VALID SQL syntax for an outer join!  If mySQL doesn't allow for that, what am I supposed to do in lieu of the fact that I have to logically join two tables together or if the one is null (the case for an outer join)?

  Phil


------------------------------------------------------------------------------


  _______________________________________________
  talk mailing list
  talk at lists.nyphp.org
  http://lists.nyphp.org/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030912/d2dc2d63/attachment.html>


More information about the talk mailing list