Converting SELECT DISTINCT ON queries from Postgresql to MySQL

前端 未结 4 1015
余生分开走
余生分开走 2020-12-02 17:27

I\'ve been using PostgreSQL and now migrating to MySQL.

In my queries, I\'m using PostgreSQL\'s SELECT DIST

4条回答
  •  死守一世寂寞
    2020-12-02 17:55

    you should migrate to PDO or MSYQLI instead of MYSQL as its already deprecated.

    about your question you can do

       SELECT DISTINCT col1, col2, col3
    

    or

        SELECT col1, col2, col3
        ........
    
        GROUP BY col1 --//--- or whatever column you want to be distinct
    

提交回复
热议问题