NYCPHP Meetup

NYPHP.org

[nycphp-talk] Error involving inner SELECT using mySQL - HELP

Jim Hendricks jim at bizcomputinginc.com
Sun Sep 21 15:11:17 EDT 2003


MessageSorry to hear you have such a struggle learning from a manual, but I wouldn't disparage a product because it doesn't lend easily to learning based on knowledge of another product.

And when it comes to association tables, I have found no problem using mySQL.  It's all in knowing that in SQL there is always more than 1 way to skin a cat ( no anti-cat sentiment meant ).

With mySQL, they have been working to add in more of the advanced features, and in fact, the foreign keys have been available for a while, the subqueries are now there, and joins have always been Ansi standard.

I can understand you learning in bits and pieces through application.  I think many people learn best this way.  A big problem with learning this way though is that you need to avoid jumping in the fire without a fire suit!  When I decide I want to learn another product so I can add it to my portfolio, I choose an application of my choosing, possibly something I have done already in another environment.  Then I try to replicate it.  I hit alot of walls, but thats when it's time to experiement, hit manuals, ask questions, etc.  Little by little the knowledge comes.  If I try this means of learning while on a "real" project, I'm not going to learn as much because I am constantly under pressure to produce.

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
______________________________________________________________

  ----- Original Message ----- 
  From: Phil Powell 
  To: NYPHP Talk 
  Sent: Sunday, September 21, 2003 2:56 PM
  Subject: Re: [nycphp-talk] Error involving inner SELECT using mySQL - HELP


  Jim, if I had that kind of learning ability I would do so, but unfortunately I can only take things in small bite-sized pieces, therefore, a manual would do me no good as a whole.  Usually when it comes to manuals I can only pick at what I understand and/or need at the moment and apply.  In fact, my entire ability is based on application, not on foreknowledge or logical cognition.  In other words, I know that to make a cake you add these ingredients until it works, not that you already know to do this/that/other based on what you read, because often times what I read makes no sense to me anyway.

  Sorry, that's how I've always viewed the world since birth and school.  Somehow I've compensated for this severe ability lacking and done what I needed to get done.  In the case of creating relational data models of complexities ranging from lookup tables to association tables (as is the case of this freelance project I'm working on), mySQL doesn't cut it.  Oracle, SQL Server and even Sybase (that I don't know) would cut it quite well.  That's how I view it.

  Phil
    ----- Original Message ----- 
    From: Jim Hendricks 
    To: NYPHP Talk 
    Sent: Sunday, September 21, 2003 2:51 PM
    Subject: Re: [nycphp-talk] Error involving inner SELECT using mySQL - HELP


    I wouldn't categorize mySQL a waste of database.

    It depends on your needs.  Do you need a fast, small, cheap database which is easy to get into and use, or a advanced, expensive, database that takes months of studying to begin to utilize to it's best abilities?

    Oracle, Sybase, MSSQL etc. have been available for quite some time, have many advanced features, but comes at quite a cost in money, maint, learning curve, and resources.  If you app needs high-end database functionality, then you have to be willing to part with some money, time, and resources.

    mySQL on the other hand has not been around as long as the commercial products, and has at it's foundation a small footprint with the majority of the learning curve in learning SQL and has a very low price - free.  So far, mySQL has worked extremly well in many of my apps.  Sometimes I have to rethink my design because I am thinking too much in the "large db" mindset, but that's me, not mySQL.

    It seems to me that you could really benefit from sitting down with the mySQL manual for a short spell, especially the part about mySQL Ansi 92 support.  It might be beneficial to also get aquanted with Oracle's proprietary aspects so you understand what features need a different solution because your assuming an Oracle feature is Ansi 92.

    This would be true no matter what DB product you pick up.  I got my start in SQL with MSSQL.  When I tried to get into Oracle I was ready to call Oracle a piece of garbage because I couldn't do anything with it.  The joins were different, the allocations different, the stored procedure language different, the permissions systems different.  But after weeks of working with the product, I began to learn the Oracle way and realized my judgement of Oracle was not based on the merits/demerits of Oracle, but on my lack of knowledge of the product and what it's target audience is.

    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
    ______________________________________________________________

      ----- Original Message ----- 
      From: Phil Powell 
      To: NYPHP Talk 
      Sent: Sunday, September 21, 2003 2:17 PM
      Subject: Re: [nycphp-talk] Error involving inner SELECT using mySQL - HELP


      I did, it seems that mySQL is becoming more and more of a waste of database!

      Can't do subqueries, can't do foreign key constraints, even the datetime field column datatype doesn't allow for the now() function as an input parameter value in INSERT?.. so tell me what GOOD is mySQL anyway????

      I rewrote the entire database table schema relational structure to include another association table and used that, flatting out the query.  However, it's really BAD coding because I have this query generating for every single $row['nnet_produkt_id'] from the outer query results.  BAD BAD BAD.. that means a while loop INSIDE another while loop!

      Can you say performance murder!

      Phil


        ----- Original Message ----- 
        From: Jeff Siegel 
        To: 'NYPHP Talk' 
        Sent: Sunday, September 21, 2003 1:46 PM
        Subject: RE: [nycphp-talk] Error involving inner SELECT using mySQL - HELP


        You need at least ver. 4.1 of mySql. You may also be able to rewrite it.
        See: http://www.mysql.com/doc/en/ANSI_diff_Subqueries.html

        Jeff Siegel
          -----Original Message-----
          From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Phil Powell
          Sent: Sunday, September 21, 2003 11:54 AM
          To: NYPHP Talk
          Subject: [nycphp-talk] Error involving inner SELECT using mySQL - HELP


          Ok guys, here we go again!

          SELECT s.nnet_produkt_storrelse_navn 
          FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v, nnet_storrelse_varegruppe_assoc sv 
          WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse id 
           AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id 
           AND sv.nnet_produkt_varegruppe_id IN (
             SELECT nnet_produkt_varegruppe_id 
             FROM nnet_produkt_varegruppe
             WHERE nnet_produkt_varegruppe_code =  'FLU17' 
           )
           AND s.nnet_produkt_storrelse_id > 1

          This produces the following error:

          You have an error in your SQL syntax near 'id AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id AND sv.nnet_' at line 1

          I don't see anything wrong with this query, it's standard inner SELECT stuff!  I need help... again!

          Phil


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


        _______________________________________________
        talk mailing list
        talk at lists.nyphp.org
        http://lists.nyphp.org/mailman/listinfo/talk



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


      _______________________________________________
      talk mailing list
      talk at lists.nyphp.org
      http://lists.nyphp.org/mailman/listinfo/talk



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


    _______________________________________________
    talk mailing list
    talk at lists.nyphp.org
    http://lists.nyphp.org/mailman/listinfo/talk



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


  _______________________________________________
  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/20030921/33f2c7ea/attachment.html>


More information about the talk mailing list