SELECT *
FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA ='dbname' -- Нужно указать схему
AND TABLE_NAME ='tablename' -- Нужно указать таблицу
AND CONSTRAINT_NAME <>'PRIMARY'
AND REFERENCED_TABLE_NAME is not null;
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'price' -- Таблица
AND table_schema = 'db_name' -- Имя БД
AND column_name = 'pr1' -- Колонка
) > 0,
"SELECT 1",
" ALTER TABLE `price` ADD `pr1` tinyint(1) NOT NULL AFTER `type`;"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT T2.*,
T1.OPSOS AS OPSOS1, T1.REGION AS REGION1, -- phone1
T3.OPSOS AS OPSOS2, T3.REGION AS REGION2, -- phone2
CASE WHEN T2.PREFIX = 0 THEN T1.OPSOS ELSE T3.OPSOS END OPSOS, -- phone1 or phone2
CASE WHEN T2.PREFIX = 0 THEN T1.REGION ELSE T3.REGION END REGION -- phone1 or phone2
FROM TABLE2 T2
LEFT JOIN TABLE1 T1
ON T1.PREFIX = T2.PREFIX
AND T1.PHONE BETWEEN T2.MIN AND T2.MAX
LEFT JOIN TABLE1 T3
ON T3.PREFIX = T2.PREFIX
AND T3.PHONE BETWEEN T2.MIN AND T2.MAX
WHERE T2.SITY = 'Москва';
//string[] str = json "Ноябрь": "3*,4,5,6,11,12,18,19,25,26"
string[] str = { "3*", "4", "5", "6", "11", "12", "18", "19", "25", "26" };
И причем тут php если ошибку показывает MySQL WorkBench?
Если ошибка только в MySQL WorkBench, то думаю нужно увеличить время
В настройках MySQL WorkBench увеличь время.
Edit > Preferences > SQL Editor > в разделе MySQL Session/b>