Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- Install APXS in Redhat Linux
- react-pdf, display pdf in react.js
- Set Windows path command line
- MySQL date created and date modified
- Transfer modules between sites
- DataTable table order by numeric, not by text
- datatable order by nunmeric
- mod_auth_cas.so error: undefined symbol: SSL_connect
- JavaScript, remove trailing insignificant zeros after toFixed function
Thursday, November 5, 2015
MySQLcase When Then END in comparison
Below is an example to use case When Then END in comparison in MySQL:
(CASE WHEN stakeholders.Action = 'New' AND stakeholders.InitialHireDate IS NOT NULL
AND stakeholders.InitialHireDate < (
CASE WHEN contract.SEApptStartDate IS NULL THEN terms_contract_lut.SEApptStartDate
ELSE contract.SEApptStartDate
END
) THEN 'REH' ELSE UPPER(stakeholders.Action)
END) AS Action,
(CASE WHEN stakeholders.Action = 'New' AND stakeholders.InitialHireDate IS NOT NULL
AND stakeholders.InitialHireDate < (
CASE WHEN contract.SEApptStartDate IS NULL THEN terms_contract_lut.SEApptStartDate
ELSE contract.SEApptStartDate
END
) THEN 'REH' ELSE UPPER(stakeholders.Action)
END) AS ActionReason,
Tuesday, November 3, 2015
Commas as thousands separators in number in Javascript
For example, we want to display 1000 as 1,000. JavaScript function
toLocaleString is used, example:n=1000;
m=n.toLocaleString();
m will be 1,000
If n is a string, we need to convert to number first
Number(n).toLocaleString();
toFixed(2) convert a number into a string, keeping only two decimals, we need to convert it to number when using toLocaleString()m = Number(n. toFixed(2)).
toLocaleString();
Subscribe to:
Comments (Atom)