摘要:
行号:Select UID,(@rowNum:=@rowNum+1) as rowNoFrom a,(Select (@rowNum :=0) ) b 阅读全文
摘要:
CREATE PROCEDURE `justifyGroupNum`() NOT DETERMINISTIC SQL SECURITY DEFINER COMMENT '' BEGIN /*how to run:call justifyGroupNum()*/ DECLARE p_group_id int; declare p_num int; declare stopFlag int; DECLARE cursor_name CURSOR FOR select c_group_id,count(*) as num from `t_group_member` where c_v 阅读全文
摘要:
--对一个表取任意随机数 SELECT * FROM TMP_XF_TEST WHERE ID >= (SELECT FLOOR(RAND() * (SELECT MAX(ID) FROM TMP_XF_TEST))) order by id LIMIT 1;--有条件性的取随机数 SELECT * FROM TMP_XF_TEST WHERE ID >= (SELECT FLOOR(RAND() * ((SELECT MAX(ID) FROM TMP_XF_TEST WHERE GID = 9) - (SELECT MIN(ID) FROM TMP_XF_TEST WHERE G 阅读全文