Menu

Problem with join

2004-08-31
2004-08-31
  • Nobody/Anonymous

    My database is SAP (mysql).
    Your code genera the following sql:

    SELECT t1.codigocliente AS t1_codigocliente, t1.nombre AS t1_nombre, t1.apellidos AS t1_apellidos, t1.nif AS t1_nif, t1.razonsocial AS t1_razonsocial, t1.fechaalta AS t1_fechaalta, t1.codigoformapago AS t1_codigoformapago, t1.codigoformaenvio AS t1_codigoformaenvio, t1.CreatedDate AS t1_CreatedDate, t1.ModifiedDate AS t1_ModifiedDate, t2.codigoformapago AS t2_codigoformapago, t2.nombre AS t2_nombre, t2.CreatedDate AS t2_CreatedDate, t2.ModifiedDate AS t2_ModifiedDate, t3.codigoformaenvio AS t3_codigoformaenvio, t3.nombre AS t3_nombre, t3.CreatedDate AS t3_CreatedDate, t3.ModifiedDate AS t3_ModifiedDate FROM ((cliente as t1 LEFT JOIN formapago as t2 ON t1.codigoformapago = t2.codigoformapago) LEFT JOIN formaenvio as t3 ON t1.codigoformaenvio = t3.codigoformaenvio) WHERE  t1.codigocliente = 6

    but my database don't support this way.

    My database support the following way:

    SELECT t1.codigocliente AS t1_codigocliente, t1.nombre AS t1_nombre, t1.apellidos AS t1_apellidos, t1.nif AS t1_nif, t1.razonsocial AS t1_razonsocial, t1.fechaalta AS t1_fechaalta, t1.codigoformapago AS t1_codigoformapago, t1.codigoformaenvio AS t1_codigoformaenvio, t1.CreatedDate AS t1_CreatedDate, t1.ModifiedDate AS t1_ModifiedDate, t2.codigoformapago AS t2_codigoformapago, t2.nombre AS t2_nombre, t2.CreatedDate AS t2_CreatedDate, t2.ModifiedDate AS t2_ModifiedDate, t3.codigoformaenvio AS t3_codigoformaenvio, t3.nombre AS t3_nombre, t3.CreatedDate AS t3_CreatedDate, t3.ModifiedDate AS t3_ModifiedDate FROM  cliente t1 LEFT JOIN formapago t2 ON t1.codigoformapago = t2.codigoformapago LEFT JOIN formaenvio  t3 ON t1.codigoformaenvio = t3.codigoformaenvio WHERE  t1.codigocliente = 6

     
    • Richard Banks

      Richard Banks - 2004-08-31

      Sorry, I don't quite follow.

      Is your database a standard MySQL database or is it the MaxDB database that SAP released?

      If it's the MaxDB version, I haven't used it personally, but I'm VERY suprised it doesn't support bracketing in the join clause.

      To get rid of the brackets will mean some changes in terms of the database providers and some code will be required.

      Can you post a request (RFE) for this and include the specific version of the database server you are using so that I can make sure I cater for any other syntax issues that may be present.

      - Richard

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.