› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
mechille
V2EX  ›  MySQL

请问MYSQL里如何取得某个字段除了后三位的字符串

  •  
  •   mechille · May 16, 2013 · 4721 views
    This topic created in 4914 days ago, the information mentioned may be changed or developed.
    比如

    a
    123001
    3405002
    56700003

    我想取得除了后三位001,002,003的前面的数字。要怎么截取?

    PS:只能MYSQL操作
    6 replies  •  1970-01-01 08:00:00 +08:00
    heyli
        1
    heyli  
       May 16, 2013
    RIGHT函数
    google下mysql 字符串截取
    123123
        2
    123123  
       May 16, 2013   ❤️ 1
    SUBSTR(column_name, 1, LENGTH(column_name)-3)
    mechille
        3
    mechille  
    OP
       May 16, 2013
    @123123 正解

    @heyli right要如何写...
    heyli
        4
    heyli  
       May 16, 2013
    SELECT RIGHT(字段,3) from table
    66beta
        5
    66beta  
       May 16, 2013
    赞2楼,思路很清楚,长度-3
    mechille
        6
    mechille  
    OP
       May 17, 2013
    @heyli 未看明白我说的意思吧 - -
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1578 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 17:46 · PVG 01:46 · LAX 10:46 · JFK 13:46
    ♥ Do have faith in what you're doing.