SQL 和MYSQL的差別

2021-08-11 12:27:32 字數 1721 閱讀 1564

在sql中字串拼接用 wf_dqdatel+' ' + wf_dqtimel 

在mysql用  concat(wf_dqdatel,' ',wf_dqtimel) 

在sql中 select datediff(d,日期1,日期2)  結果 日期2-日期1

在mysql中 select    timestampdiff(d,日期1,日期2)  結果 日期2-日期1

for xml path寫法

sql : select a.*,b.wf_snam,bb.wf_snam as wf_fasnam,c.wf_signtxt,c.wf_signresult,c.wf_date, 

c.wf_bdate,c.wf_btime,c.wf_time,e.wf_rwdesc,f.wf_dpdesc,g.wf_desc as wf_sitdesc 

,tag_name= ( select tag_name +','  from lrtags x left join lrwf00d5 y on y.tag_id = x.tag_id where a.uid = y.wf_id for xml path('') )                            

from lrwf00d1 a   

left join lrwf07h b  on a.wf_sale=b.wf_sale 

left join lrwf07h bb  on a.wf_fasale=bb.wf_sale 

left join lrwf01h c  on a.wf_no=c.wf_no and a.wf_lev=c.wf_lev and a.wf_sale=c.wf_osale  and c.wf_duplicate<>'y'  

left join lrwf00h d  on a.wf_no=d.wf_no  

left join lrwf02d2 e  on a.wf_seq=e.wf_seq and d.wf_type=e.wf_type +

left join lrwf06h f on a.wf_dpno=f.wf_dpno 

left join lrwf17h g on a.wf_sitno=g.wf_sitno;

mysql: for xml path寫法替換為: (select group_concat(x.tag_name ) tag_name  from lrtags x left join lrwf00d5 y on y.tag_id = x.tag_id where a.uid = y.wf_id )as tag_name                      

group_concat函式返回乙個字串結果,該結果由分組中的值連線組合而成。

在sql中cast(*** as 型別) , 

convert

(型別,***)

在mysql 中 cast(*** as 型別) , 

convert

(***,型別)。

sql 

select * into person_bakupc   form person

mysql 

create temporary table  

person_bakupc   (select user_id,user_name from tb_user); 

sql  cast(a.idle_days as float)

mysql  cast(a.idle_days as decimal)  在mysql  中cast不認float

ifdef和 if的差別

最近專案要從windows平台移植到linux平台,所以做了很多相容性相關的工作。遇到乙個小問題,我想通過win32巨集來區分兩個平台,之前以外win32變數是自己定義到,所以我做了如下宣告 define win32 1 1 windows,0 linux 程式中這樣使用 if win32 1 do...

引用和指標的差別,陣列和指標的差別

一 引用和指標的差別 1 引用並不是物件,它僅僅是為乙個已存在的物件所起的另外乙個名字。必須初始化,並且無法改變它繫結的物件,之後每次使用這個引用都是訪問最初繫結的那個物件。2 指標本身是物件,能夠不用初始化,能夠改變指標指向的物件 二 指標與陣列的差別 指標陣列 儲存資料的位址 儲存資料 間接訪問...

MySQL中整型資料的差別

bigint 從 2 63 9223372036854775808 到 2 63 1 9223372036854775807 的整型資料 所有數字 儲存大小為 8 個位元組。p.s.bigint已經有長度了,在mysql建表中的length,只是用於顯示的位數,一般bigint 20 這個寬度和bi...