zoukankan      html  css  js  c++  java
  • 查询各分类中最大自增ID

    假如现在有表结构:

    CREATE TABLE `msg_detail` (
        `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
        `title` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '标题',
        `content` TEXT NOT NULL COMMENT '内容',
        `audio_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '音频地址',
        `type_id` TINYINT(4) NOT NULL DEFAULT '0',
         PRIMARY KEY (`id`),
        INDEX `cid` (`cid`) USING BTREE,
        INDEX `column_id` (`column_id`) USING BTREE
    )
    COMMENT='内参表'
    COLLATE='utf8_general_ci'
    ENGINE=InnoDB
    AUTO_INCREMENT=1;

      查询所有类型内参最大id,可用如下sql: 

     select max(id),type_id from msg_detail group by type_id; 

  • 相关阅读:
    MathML
    Redux counterpart rematch dva
    flow
    pauseable 库
    a simple machine learning system demo, for ML study.
    react图工具集成
    SQLite
    Celery
    RabbitMQ installation
    Thunk
  • 原文地址:https://www.cnblogs.com/wscsq789/p/9450064.html
Copyright © 2011-2022 走看看