Skip to content

Instantly share code, notes, and snippets.

@Buzovskiy
Buzovskiy / set_translation_for_products.sql
Created Jan 13, 2021
SQL запрос на заполнение переводов для товаров для выбранного языка
View set_translation_for_products.sql
INSERT INTO product_lang (id_product,id_lang,title, description)
SELECT
p.id,
l.id_lang,
NULL,
concat('description_test','_', l.iso_code)
FROM products p
LEFT JOIN lang l ON l.id_lang != 1
View Очистка не нужных свойств
DELETE FROM `feature_value` WHERE id_feature_value NOT IN (SELECT DISTINCT fp.id_feature_value FROM feature_product fp ) AND id_feature NOT IN (112, 111)
@Buzovskiy
Buzovskiy / jquery dialog window button
Created Nov 28, 2020
jquery dialog window button
View jquery dialog window button
init_social_button : function(){
let button = $(".social-top .social-button");
let dialogWindow = $(".social-top ul");
button.click(function(e){
button.toggleClass("active");
dialogWindow.toggle();
});
$(".social-top").click(function(e){
e.stopPropagation();
})
@Buzovskiy
Buzovskiy / delete_duplicates.sql
Created Feb 21, 2020
Для удаления дубликатов подойдет такой прием:
View delete_duplicates.sql
CREATE TEMPORARY TABLE `t_temp`
as (
SELECT min(id) as id
FROM `table`
GROUP BY name, surname
);
DELETE from `table`
WHERE `table`.id not in (
SELECT id FROM t_temp