› 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 · 4767 views
    This topic created in 4937 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
    heyli
    May 16, 2013
    1
    RIGHT函数
    google下mysql 字符串截取
    123123
    123123
    May 16, 2013❤️1
    2
    SUBSTR(column_name, 1, LENGTH(column_name)-3)
    mechille
    mechille
    OP
    May 16, 2013
    3
    @123123 正解

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