MySql经典语句

1.三个函数: LENGTH  SUBSTR   LOCATE

select * from hbl_product where LENGTH(SUBSTR(WebSiteShopUrl,LOCATE('=',WebSiteShopUrl)+1))=4    order by WebSiteShopUrl   desc

2.序号 两种方法

第一种方法:
select (@i:=@i+) as i,table_name.* from table_name,(select @i:=) as it
第二种方法: set @rownum=;
select @rownum:=@rownum+ as rownum, t.username from auth_user t limit ,;

3.ifnull 如果为null,则为0

ifnull(hci.Count,0)

上一篇:POJ1738 An old Stone Game


下一篇:JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍