Recently I started playing with the embedded SQL manager to make queries that are useful in shop maintanance.
I noticed that my products contain information for language ids that are not currently installed (or active). I can't remember if I used to have additional languages in this shop instance before.
Currently I have:
But this query:
SELECT pl.id_product, pl.id_lang, pl.description_short, LENGTH(pl.description_short)as short_description_length
FROM tb_product_lang pl
WHERE LENGTH(pl.description_short)<50;
pulls the following table:
My question is: as I don't have lang ID 3 and 5 could I safely delete all those records (and also every other record, even if larger than 50 characters) for those IDs? Could I use this query for doing so:
DELETE pl
FROM tb_product_lang pl
LEFT JOIN tb_lang l ON pl.id_lang = l.id_lang
WHERE l.active =0 OR l.id_lang IS NULL;
If I understand it correctly even if I had let's say Spanish as ID=3 and I remove it and I add it again it will get the next unused langID, not return to 3? In this case why deleting the language is also not deleting all records associated with this ID (products, image descriptions, features, etc.)?
Question
the.rampage.rado
Recently I started playing with the embedded SQL manager to make queries that are useful in shop maintanance.
I noticed that my products contain information for language ids that are not currently installed (or active). I can't remember if I used to have additional languages in this shop instance before.
Currently I have:
But this query:
pulls the following table:
My question is: as I don't have lang ID 3 and 5 could I safely delete all those records (and also every other record, even if larger than 50 characters) for those IDs? Could I use this query for doing so:
If I understand it correctly even if I had let's say Spanish as ID=3 and I remove it and I add it again it will get the next unused langID, not return to 3? In this case why deleting the language is also not deleting all records associated with this ID (products, image descriptions, features, etc.)?
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now