A comparison SQL statement

Source: Internet
Author: User
If it is positive, it is displayed as +. If it is negative, it is displayed as "-". If it is not, it is displayed as "-". This statement is passed in the MSSQLserver2000 test -- hjc is the number of records, if there is no record, there is no comparability. Otherwise show compare value casewhenhjc0then-elseCAST (casewhen (hj-hjc) 0 then + + cast (hj-hjc) asvar

If it is positive, it is displayed as +. If it is negative, it is displayed as "-". If it is not, it is displayed as "-". This statement is passed in the MSSQLserver2000 test -- hjc is the number of records, if there is no record, there is no comparability. Otherwise, the Compare value case when hjc = 0 then'-'else CAST (case when (hj-hjc) 0 then' + '+ cast (hj-hjc) as var is displayed.

If it is positive, it is displayed as "+". If it is negative, it is displayed as "-". If it is not, it is displayed as "-". This statement is passed in the MSSQLserver2000 test.

<无>
-- Hjc indicates the number of records. If there is no record, there is no comparability. Otherwise, the Compare value case when hjc = 0 then'-'else CAST (case when (hj-hjc)> 0 then' + '+ cast (hj-hjc) as varchar) is displayed) else cast (hj-hjc) as varchar) end as varchar (5000) end as hj2, case when hjc = 0 then'-'else CAST (case when wfhjc = wfhj then 0 WHEN wfhjc = 0 AND wfhj> 0 THEN 100 else (wfhj-wfhjc) * 100.0/wfhjc end as decimal (5000) as varchar () end as wfl2,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.