如何调试`#1060 - 在MySQL中重复列名' id'`

时间:2016-08-20 08:58:45

标签: mysql sql phpmyadmin ddl

CREATE TABLE `testphp` 
( 
     `id`     INT(11) NOT NULL auto_increment, 
     `id`     NUMERIC(60) DEFAULT NULL, 
     `name`   VARCHAR(255), 
     `email`  VARCHAR(255), 
     `mobile` NUMERIC(60) DEFAULT NULL, 
     `image`  VARCHAR(255), 
     `gender` VARCHAR(255), 
     `day`    VARCHAR(255), 
     `status` ENUM('0', '1'), 
     PRIMARY KEY (`id`) 
); 

2 个答案:

答案 0 :(得分:1)

您的<!DOCTYPE html> <html > <head> <meta charset="UTF-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="/socket.io-client/socket.io.js"></script> <style> body { margin-top:30px; } .hidden { display: none; } </style> <script type="text/javascript"> var count=2; var activerows=document.getElementsByClassName("hidden"); for (var i=0; i<activerows.length; i++) { activerows[i].style.display='block'; } </script> </head> <body> <div class="container"> <div class="row"> <div class="col-md-8"> <table class="table table-striped table-border" id="dealers"> <tbody> <tr class="hidden active"> <th>A</th> <th>B</th> <th>C</th> <th>D</th> </tr> <tr class="hidden"> <td>1</td> <td>2/td> <td>3</td> <td>4m</td> </tr> <tr class="hidden"> <td>5</td> <td>6</td> <td>7</td> <td>8</td> </tr> <tr class="hidden"> <td>9</td> <td>10</td> <td>11</td> <td>12</td> </tr> </tbody> </table> </div> <div class="more" id="more"> <button type="submit" class="fbtn btn-default">More....</button> </div> </div> </div> </body> </html> 声明中有两列名为id的列。重命名其中一个:

create table

或者只是在没有必要时删除它:

CREATE TABLE `testphp`(
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `another_id` NUMERIC(60) DEFAULT NULL, -- Here!
    `name` VARCHAR(255),
    `email` VARCHAR(255),
    `mobile` NUMERIC(60) DEFAULT NULL,
    `image` VARCHAR(255),
    `Gender` VARCHAR(255),
    `Day` VARCHAR(255),
    `status` ENUM('0','1'),
    PRIMARY KEY (`id`) 
);

答案 1 :(得分:0)

在SQL中实际上有两列名为id的列,尝试重命名一列。