mysqllect定义变量,Mysql:在lect中设置⼀个变量SELECT alias.urname AS phone_number,
简笔画坦克
subscriber.urname AS ur_name
愿望拼音FROM alias, subscriber
天蝎男摩羯女act REGEXP CONCAT('^sip:', subscriber.ur_name, '[.*]')请注意,以下查询将更有效:
SELECT alias.urname AS phone_number,
subscriber.urname AS ur_name
FROM alias, subscriber
act LIKE CONCAT('sip:', subscriber.ur_name, '%'),⽽这个虽然看起来很复杂,但效率更⾼:
重启高一CREATE FUNCTION fn_get_next_subscriber(initial VARCHAR(200)) RETURNS VARCHAR(200)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE _urname VARCHAR(200);
DECLARE EXIT HANDLER FOR NOT FOUND RETURN UNHEX('FFFF');
SELECT urname
INTO _urname
FROM subscribers
WHERE urname>= initial关于思乡的古诗
AND urname NOT LIKE CONCAT(initial, '%')
ORDER BY
urname
LIMIT 1;
RETURN _urname;
安适
学富五车造句END
SELECT a.urname AS phone_number,
s.urname AS ur_name
FROM (中式大餐
SELECT si.*, CONCAT('sip:', urname) AS fromcontact
FROM subscriber si
) s, alias a
act >= fromcontact
act < fn_get_next_subscriber(fromcontact)这将使⽤alias (contact)上的索引并避免全表扫描。
在我的博客中看到这篇⽂章: