SELECT DISTINCT
LAST_VALUE(`name`) OVER `win` AS `last_name`,
LAST_VALUE(`dateism`) OVER `win` AS `last_dateism`,
`idshare`
FROM `table`
WINDOW `win` AS (
PARTITION BY `idshare`
ORDER BY `dateism`
RANGE BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
)
SELECT `FIO` AS `fio`, 1 AS `position`
FROM `test`
WHERE `FIO` REGEXP CONCAT('^ *', :needle)
UNION SELECT `FIO`, 2
FROM `test`
WHERE `FIO` REGEXP CONCAT('^ *[^ ]+ +', :needle)
AND NOT `FIO` REGEXP CONCAT('^ *', :needle)
UNION SELECT `FIO`, 3
FROM `test`
WHERE `FIO` REGEXP CONCAT('^ *[^ ]+ +[^ +] +', :needle)
AND NOT `FIO` REGEXP CONCAT('^ *[^ ]+ +', :needle)
AND NOT `FIO` REGEXP CONCAT('^ *', :needle)
ORDER BY `position`, TRIM(`fio`);
SELECT COUNT(DISTINCT `leads`.`PHONE`)
FROM `leads`
LEFT JOIN `sites` ON `sites`.`SOURCE_ID` = `leads`.`SOURCE_ID`
WHERE `leads`.`PHONE` != '9 (999) 999 99-99'
AND `leads`.`NAME` != 'тест'
AND `leads`.`SOURCE_ID` IN (1,3,4,5,6,7,8,10,11,12,14,15)
AND `DATE_CREATE` BETWEEN '2020-06-01' AND '2020-06-30'
$mysql = new mysqli('localhost', 'root', '', 'register');
$stmt = $mysql->prepare("SELECT `password` FROM `users` WHERE `login` = ?");
$stmt->bind_param('s', $login);
$stmt->execute();
$stms->bind_result($hash);
if (!$stmt->fetch() || !password_verify($password, $hash)) {
echo 'Error';
}