Fernanditos
asked on
Dumping mysql table but skipping duplicated titles
Hi,
I have a book table (books_bok) with 3K titles. I want to dump another table (with exact same structure) but I want to avoid / skip duplicate titles.
What would be a good practice to do in this case ?
I attach the database structure in case it helps.
Thank you.
db.txt
I have a book table (books_bok) with 3K titles. I want to dump another table (with exact same structure) but I want to avoid / skip duplicate titles.
What would be a good practice to do in this case ?
I attach the database structure in case it helps.
Thank you.
db.txt
ASKER
I don't think it makes much sense since you do not specify the column I want to have unique: "title_bok" ?
Do you understand what I mean? makes sense?
Do you understand what I mean? makes sense?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, maybe this would work (didn't test it)
CREATE TABLE new_books_bok SELECT * FROM books_bok GROUP BY title_bok;
in case you want to have latest details for that perticular title you might use order by clause in above query:
CREATE TABLE new_books_bok SELECT * FROM books_bok GROUP BY title_bok order by id desc;
CREATE TABLE new_books_bok SELECT * FROM books_bok GROUP BY title_bok order by id desc;
CREATE TABLE new_books_bok SELECT DISTINCT * FROM books_bok;