Menu

mysql command

Help
2003-05-01
2012-09-19
  • Flemming Bjerke

    Flemming Bjerke - 2003-05-01

    Could anyone tell my why:

    select * from mytable;
    select co1,col2 from mytable;

    does not work, whereas

    select* from mytable;
    select(col1) from mytable;

    work fine? It is not in accordance with the documentation for mysql, (though all four commands work in mysql).

    But how do I select from more collums?

    select(col1,col2) from mytable;

    does not work???

    Flemming

     
    • Flemming Bjerke

      Flemming Bjerke - 2003-05-01

      well, I found out that the following strang command works:

      select' ' col1, col2, col3 from mytable;

      But, it can't retreive that values from col1. It seems that the space behind select is not recognized by ZMysqldb.

      Flemming

       
      • Andy Dustman

        Andy Dustman - 2003-05-01

        ZMySQLDA probably requires there to be some whitespace after the "SELECT" keyword, even if SQL syntax does not strictly require it.

        By the way, "does not work" is not a very useful problem support, particularly when you don't even say what you are using; in your original post, you did not say if you were using MySQLdb or ZMySQLDA.

         
        • Flemming Bjerke

          Flemming Bjerke - 2003-05-01

          Well, a white space after select was my first try, and it did not work. That gave me the idea of trying ' ', and that works except the following string will be header of the first returned column whatever the string contains. Then, komma and white space and column-names works fine. E.g.

          select''odd, col1,col1 from mytable;

          will return a table with three columns where the first has the name odd with no values. The two next columns has the content of col1 and col2.

          select 7+3;
          does not work, but

          select'''', 7+3;
          returns two columns where the first is named ' and filled with '. The second is named 7+3 and is filled with 10.

          It looks like ZMysqldb won't recognize a blank space after select. Strange because insert works fine.

          Sorry, for not supplying sufficient information.

          Flemming

           
    • Greg Fortune

      Greg Fortune - 2003-05-01

      Works fine over here.  Can you post relevent code and version numbers for python, mysql, and MySQLdb?

       
    • Flemming Bjerke

      Flemming Bjerke - 2003-05-01

      zope 2.6.1 with python2.1.3 (installed with rpm on mdk. 9.0)
      mysql4.0.12
      MySQL-python-0.9.2.tar.gz
      ZMySQLDA-2.0.8.tar.gz

      When I ssh to the linuxbox and login to mysql the select works normal, so it must be something with later on.

      Thank, you for response. To night, I will try on my machine back home.

      Flemming

       
    • Andy Dustman

      Andy Dustman - 2003-05-04

      Don't use semicolons in Z SQL Methods. If you must have multiple statements, separate them with <dtml-var sql_delimiter>.

      (you found the answer in another thread, I am repeating it for the benefit of others who find this)

       

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.