Everyday SQL (3)

October 21, 2016 lilo 3

–Common Table Expressions (not called Temporary table, many thanks to YZ to correct me, refer to http://www.sql-server-performance.com/2015/common-table-expressions-cte-developers/) with T as ( select Product_ID,max(case when MEDIA_LEG_RESULT=’T’ […]

Everyday SQL (2)

September 22, 2016 lilo 0

SQL today For each comm_id, there are several items. For each item, there is a fulfillment method. For each item, there is a row in […]

Everyday SQL (1)

September 7, 2016 lilo 0

最基本的常用sql code 今天用了一天R和SQL,SQL是在Data Ware House (DW) 跑的,具体的流程十几分钟一学就会,主要是要会写SQL code. 我是自学的,贴一段工作中用的最基本的,初学者可以先从最基本的和理解这段code开始,学会最常用的where 和 left join。 select distinct tabled.comm_id, o1.component_id as sic1, o2.component_id as sic2 from contact_detail tabled left […]