MySql怎样获取一列中最大值
6个回答
展开全部
1、创建测试表,
create table test_max(id int , value varchar(20));
2、插入测试数据
insert into test_max values(1,'v1');
insert into test_max values(2,'v2');
insert into test_max values(3,'v3');
insert into test_max values(4,'v4');
insert into test_max values(5,'v5');
insert into test_max values(6,'v6');
commit;
3、查询表中数据,select t.* from test_max t;
4、编写sql,获取一列(id列)中最大值; select max(id) from test_max;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
假定你的列名为money,标明为product。那么语句为:别忘记在语句后加分号!
SELECT MAX(money) AS 'max_money' FROM product;
SELECT MAX(money) AS 'max_money' FROM product;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select max(列名) from table_name
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如下:
mysql> mysql>select max(group) as maxid from dm_user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
>select max(group) as maxid from dm_user' at line 1
mysql>
mysql> mysql>select max(group) as maxid from dm_user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
>select max(group) as maxid from dm_user' at line 1
mysql>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询