0

i have this query witch concatenates firstname with last name and then find the duplicates:

SELECT import.*, import.CONCAT(nume,' ',prenume) full2 
FROM import 
INNER JOIN (SELECT CONCAT(nume,' ',prenume) full,COUNT(*) 
            FROM import 
            WHERE users_id=1 
            GROUP BY full 
            HAVING COUNT(*)>1) as t2 ON import.full2 = t2.full 
WHERE users_id=1

i think the sql syntax is correct but i get the error: 1548 - Cannot load from mysql.proc. The table is probably corrupted

is there any problem with the 5.1.59 mysql version?

juergen d
  • 201,996
  • 37
  • 293
  • 362
wpglitch
  • 51
  • 2
  • 10

3 Answers3

0

Examines all tables in all databases for incompatibilities with the current version of MySQL Server:

mysql_upgrade -uroot -p

http://dev.mysql.com/doc/refman/5.0/en/mysql-upgrade.html

shilovk
  • 11,718
  • 17
  • 75
  • 74
0

Do that

CONCAT(import.nume,' ',import.prenume) full2 

instead of

import.CONCAT(nume,' ',prenume) full2 

Update

Try that:

SELECT t1.*, CONCAT(t1.nume,' ',t1.prenume) full2 
FROM import t1
INNER JOIN (SELECT CONCAT(i2.nume,' ',i2.prenume) `full`, COUNT(*) 
        FROM import i2
        WHERE i2.users_id=1 
        GROUP BY `full`
        HAVING COUNT(*)>1) as t2 ON full2 = t2.`full` 
WHERE users_id=1
juergen d
  • 201,996
  • 37
  • 293
  • 362
0

Change

SELECT import.*, import.CONCAT(nume,' ',prenume) full2 

to

SELECT import.*, CONCAT(import.nume,' ',import.prenume) as full2 

Note the change to the CONCAT statement and the as addition for using column aliases

as you are using a single table you could remove the import. from the column list ... alternatively you could use a table alias

SELECT i.*, CONCAT(i.nume,' ',i.prenume) as full2 
FROM import i
WHERE i.user_id = 1

as an example.

See the MySQL docs here on using the AS alias

Manse
  • 37,765
  • 10
  • 83
  • 108