相关疑难解决方法(0)

mySQL和postgreSQL中的group by子句,为什么在postgreSQL中出错?

假设我有这个表:named = the_table ,其结构是:

PostgreSQL:

 create table the_table (col3 SERIAL, col2 varchar, col1 varchar, PRIMARY KEY(col3));
Run Code Online (Sandbox Code Playgroud)

MySQL:

create table the_table ( col3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, col2 varchar(20), col1 varchar(20) )
Run Code Online (Sandbox Code Playgroud)

然后我插入表格:

INSERT INTO the_table (col2,col1) VALUES 
('x','a'),
('x','b'),
('y','c'),
('y','d'),
('z','e'),
('z','f');
Run Code Online (Sandbox Code Playgroud)

现在表格如下所示:

col3 | col2 | col1 
------+------+------
    1 | x    | a
    2 | x    | b
    3 | y    | c
    4 | y    | d
    5 | z    | e
    6 | z …
Run Code Online (Sandbox Code Playgroud)

mysql sql postgresql group-by

3
推荐指数
1
解决办法
4050
查看次数

标签 统计

group-by ×1

mysql ×1

postgresql ×1

sql ×1