Questions tagged [mysql-error-1060]

Error #1060 - Duplicate column name

If you get this error:

1060 - Duplicate column name ''

It means that the table you are trying to ALTER already has a column with that name.

You need to choose a unique name for each column that you are trying to add.

12 questions
32
votes
4 answers

#1060 - Duplicate column name 'id'

Why I get #1060 - Duplicate column name 'id' SELECT COUNT(*) FROM (SELECT * FROM `tips` `t` LEFT JOIN tip_usage ON tip_usage.tip_id=t.id GROUP BY t.id) sq
Pentium10
  • 204,586
  • 122
  • 423
  • 502
11
votes
2 answers

insert record if not exists in sql, duplicate column name

i wanted a solution to insert a record if it isn't there so i searched here and found a solution but i have another problem INSERT INTO closed_answers (question_id, subject_id) SELECT * FROM (SELECT 2, 2) AS tmp WHERE NOT EXISTS ( SELECT…
Nadeem Khedr
  • 5,273
  • 3
  • 30
  • 37
5
votes
1 answer

Alter ignore table add column if not exists using the SQL statement

i want to add a new column to a mysql table, but i want to ignore the adding of column, if the column already exists i am currently using ALTER IGNORE TABLE `db`.`tablename` ADD COLUMN `column_name` text NULL; but this is throwing an error saying :…
Syed Abdul Qadeer
  • 455
  • 1
  • 6
  • 14
3
votes
2 answers

Duplicate column names in SQL query

How do I avoid a dup column name error in MySQL when creating a VIEW on two tables that both have the same column name as shown here CREATE VIEW db.VI_RegionCity AS SELECT Region.Name, City.Name FROM db.Region Region, db.City…
enfield
  • 841
  • 3
  • 16
  • 42
3
votes
1 answer

Duplicate column on join

I'm trying to join three tables, after filtering one down to the most recent entry per user. However, all of a sudden I'm running into the error Duplicate column name 'username'. I need to join on this "duplicate" column. How do I fix this? SELECT…
Dessa Simpson
  • 1,232
  • 1
  • 15
  • 30
2
votes
4 answers

Error #1060 when importing csv in phpmyadmin - extra null columns

How can I get rid of these null columns? I'm importing my csv file to create a table on phpMyAdmin. The sql query looks appropriate but at the end, I get... `Category 1` VARCHAR( 97 ) , `Category 2` VARCHAR( 113 ) , `NULL` VARCHAR( 71 ) , `NULL`…
Marilee
  • 33
  • 1
  • 5
1
vote
1 answer

MySQL Error 1060: Duplicate column name ALTER TABLE

I am having some problems with a query because of errors in the code that I did not create. $query = $this->db->query("ALTER TABLE `" . DB_PREFIX . "customer` ADD `customer_type` TINYINT(1) NOT NULL; I'm not a coder, but have so far fixed (I…
Stefan
  • 95
  • 2
  • 13
0
votes
0 answers

Duplicate column name [Error number: 1060] - PHP Codeigniter

Why I get #1060 - Duplicate column name 'id_btp' ? This is my code public function json(){ $this->load->library('datatables'); $this->datatables->select('b.nama_btp, c.nama_bahan, d.nama_senyawa, e.cara_pengolahan, f.nama_kategori,…
0
votes
1 answer

Experienced an error #1060 - Duplicate of Column 'forum_enabled'

What is wrong with this? ALTER TABLE `groups` ADD COLUMN `forum_enabled` enum('0','1') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '0' AFTER `admindeco`; ALTER TABLE `user_badges` ADD UNIQUE INDEX `user_id, badge_id`; ALTER…
0
votes
1 answer

MySQL ADD IGNORE COLUMN not functioning properly?

I am trying to use the following code to add a column to a table. ALTER IGNORE TABLE `EWRcarta_history` ADD `history_ip` int(10) unsigned NOT NULL DEFAULT '0' I am using IGNORE because for various reasons that I don't feel like getting into,…
Jason Axelrod
  • 7,155
  • 10
  • 50
  • 78
0
votes
2 answers

MySQL reserved column names

I just ran into an error in my personal CMS software where it would tell me that the database build process was complete, but the table i was creating would consist only of an 'id' field. After some trial and error, I tried getting the exact query…
-4
votes
3 answers

How to create view in query having JOINS?

Hello I am not able to create view for following query. create view my_View as select * from product p LEFT JOIN product_description pd ON (p.product_id=pd.product_id) I have two tables TABLE1 :- Product with column as :- product_id,…
Ashish Agarwal
  • 6,215
  • 12
  • 58
  • 91