sql server 2005 工作记录

1.select t1.cust_stno, t1.st_type,t2.sttp_name, t1.CN_CERT_NBR,t1.st_size,t3.Code_text as color , 

t4.Code_text as STJD
from TstoneNo t1
left join TStoneType t2 on t1.st_type=t2.sttp_ID
left join TCode t3 on t1.st_color =t3.Code_value and t3.Code_id='COLOR'
left join TCode t4 on t1.st_purge=t4.Code_value and t4.Code_id='STJD'
where st_no='acd'

2.

select t2.CN_CERT_NBR, t7.Code_text as STJD,t2.cust_stno as custstno,t2.st_size as size,
t2.st_name,t1.*,t2.cust_id,t2.cust_moveno as custmoveno,t3.tab_no,t4.st_size,t2.st_type,t2.st_level as level_no,t3.client_po,
t2.st_price as stprice,t2.st_size,t5.sttp_name,t2.st_costprice,RTRIM(t2.st_id) as STID,
t2.st_shape,t2.st_purge,t2.st_color,t2.st_cg,t2.st_angle as angle,t2.st_area ,Convert(decimal(18,2),(case when t2.priceDW = 1 then (case when isnull(t1.tsm_count,0)<>0 THEN ROUND(isnull(t1.tsm_costprice,0)/isnull(t1.tsm_count,0),2) ELSE 0.00 END)ELSE (CASE WHEN isnull(t1.tsm_weight,0)<>0 THEN ROUND(isnull(t1.tsm_costprice,0)/isnull(t1.tsm_weight,0),2) ELSE 0.00 END) END)) AS price
from TstoneMove t1

left join ttab t3 on t1.list_no = t3.list_no
left join tstone t4 on t4.st_id=t1.st_id
left join tstoneno t2 on t1.st_no = t2.st_no
left join Tstonetype t5 on t5.sttp_id=t2.st_type
left join TCode t7 on t2.st_purge=t7.Code_value and t7.Code_id='STJD'
where t1.tsm_no ='1503231'
order by t1.rec_id

3.select * from NP_CodeMapping WHERE SystemID IN (0,1) and CodeName ='石头净度'

2018-04-242018-04-24   16:24:10

猜你喜欢

转载自www.cnblogs.com/guangzhou11/p/8931441.html