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
yakczh
V2EX  ›  MySQL

如果两个表有同名的字段,根据给定的字段,能找到是哪个表吗?

  •  
  •   yakczh · Jul 24, 2015 · 2343 views
    This topic created in 3974 days ago, the information mentioned may be changed or developed.

    比如两个表 posts commments
    其中都有字段 create_time
    $field='create_time';

    function test($filed){

    }

    能否根据字段名找出是哪个表?

    phx13ye
        1
    phx13ye  
       Jul 24, 2015
    use information_schema;

    SELECT * FROM COLUMNS WHERE COLUMN_NAME = '$filed';
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5164 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 09:27 · PVG 17:27 · LAX 02:27 · JFK 05:27
    ♥ Do have faith in what you're doing.