1、CAST
CAST: Format Conversion Functions
用法:CAST (expression AS data_type)
expression The : Any valid SQServer expression.
AS : for separating two parameters, before the data to be processed it is AS, AS after the data type is to be converted.
data_type : data type provided by the target system, including the sql_variant and bigint, can not use the user-defined data types.
Applications: The time to convert VARCHAR type
The CAST (f.order_created_time the AS VARCHAR ) the AS ' Order Time ' ,
2、CONCAT
1, Function: connecting a plurality of strings into a single string.
Syntax: concat (str1, str2, ...)
Applications: urban Address Province spliced into a complete delivery address
CONCAT(f.receiver_province_name,',',f.receiver_city_name,',',f.receiver_district_name,',',f.receiver_address) AS '收货地址',
3、GROUP_CONCAT
1, Function: the value of the same group by a packet generated in the connect, the result returns a string.
Applications: There may be a variety of the same order of payment, the balance of payments have to send another micro-channel payment, and therefore the time of connection to use GROUP_CONCAT
The GROUP_CONCAT ( the CASE the WHEN op.pay_type = . 1 THEN ' payment of balance ' the WHEN op.pay_type = 2 THEN ' micro-channel pay ' the WHEN op.pay_type = . 3 THEN ' Alipay ' the WHEN op.pay_type = . 4 THEN ' bank card payment ' the WHEN OP .pay_type = 5 THEN ' cash payment ' the WHEN op.pay_type = 6 THEN ' offer full deduction ' The WHEN op.pay_type = . 7 THEN ' online payment ' the END )
4、ROUND
Function: ROUND function for the numeric field rounded to the specified decimal
Application: The price of the class to be accurate to the decimal point
ROUND( ( f.pay_amount + f.discount_amount ) / f.sku_quantity / 100,