Skip to content

Instantly share code, notes, and snippets.

@viveknarang
Created September 22, 2017 14:27
Show Gist options
  • Save viveknarang/6b1b0d52cf1c44f06dee67297e1c85e8 to your computer and use it in GitHub Desktop.
Save viveknarang/6b1b0d52cf1c44f06dee67297e1c85e8 to your computer and use it in GitHub Desktop.
Execute:
> SELECT propCode, SUM(lineItemCost) FROM Preventative where SPRIORITY = 'Preventive Maint' group by propCode
+ ------------- + ---------------------- +
| propCode | SUM(lineItemCost) |
+ ------------- + ---------------------- +
| ba | 11134.359999999993 |
| dt | 7898.9 |
| nb | 8962.179999999998 |
| nse | -18670.01999999999 |
| nsw | 36478.72 |
| pv | 20281.73999999999 |
| pvx | 8517.81 |
| rs | 8047.879999999997 |
+ ------------- + ---------------------- +
8 rows
Execute:
> SELECT propCode, Category, SUM(lineItemCost) FROM Preventative group by Category, propCode order by propCode, SUM(lineItemCost)
+ ------------- + ------------- + ---------------------- +
| propCode | Category | SUM(lineItemCost) |
+ ------------- + ------------- + ---------------------- +
| ba | Plumbing | 121.10000000000002 |
| ba | Safety | 148.45 |
| ba | Electrical | 153.8 |
| ba | HVAC_PTAC | 276.84999999999985 |
| ba | Grounds | 1387.5 |
| ba | | 9046.66 |
| dt | Locks | 5.95 |
| dt | Pest Control | 8.75 |
| dt | Janitorial | 12.5 |
| dt | Door | 17.5 |
| dt | Flooring_Other | 27.02 |
| dt | Paint_Plaster | 109.62 |
| dt | Carpentry | 173.09 |
| dt | Plumbing | 369.45 |
| dt | Safety | 455 |
| dt | Appliances | 507.6699999999999 |
| dt | Electrical | 991.3800000000003 |
| dt | HVAC_PTAC | 1159.4199999999998 |
| dt | | 4061.55 |
| nb | Safety | 26.599999999999998 |
| nb | Plumbing | 34.5 |
| nb | | 4287.960000000001 |
| nb | Electrical | 4613.120000000001 |
| nse | | -20935.399999999994 |
| nse | Safety | 5.95 |
| nse | Plumbing | 40.6 |
| nse | Appliances | 135.55999999999997 |
| nse | HVAC_Furnace | 862.4 |
| nse | Electrical | 1220.87 |
| nsw | Grounds | 8.75 |
| nsw | Roofing | 11.55 |
| nsw | Flooring_Other | 17.5 |
| nsw | Locks | 43.480000000000004 |
| nsw | Door | 50.75 |
| nsw | Paint_Plaster | 88.23 |
| nsw | Electrical | 143.92999999999998 |
| nsw | Appliances | 211.17000000000002 |
| nsw | Safety | 521.25 |
| nsw | Plumbing | 661.4200000000001 |
| nsw | Carpentry | 745.7099999999999 |
| nsw | | 33974.98 |
| pv | Safety | 52.84000000000001 |
| pv | Appliances | 264.7 |
| pv | Electrical | 563.24 |
| pv | Plumbing | 1875.9400000000003 |
| pv | HVAC_Furnace | 3373.9599999999996 |
| pv | | 14151.059999999994 |
| pvx | Safety | 8.75 |
| pvx | Appliances | 17.5 |
| pvx | Electrical | 61.64 |
| pvx | Plumbing | 62.29999999999998 |
| pvx | HVAC_Furnace | 1402.7500000000002 |
| pvx | | 6964.87 |
| rs | HVAC_PTAC | 53.55000000000001 |
| rs | Safety | 95.10000000000001 |
| rs | Electrical | 108.55 |
| rs | Plumbing | 1592.8500000000001 |
| rs | | 6197.829999999996 |
+ ------------- + ------------- + ---------------------- +
58 rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment