SQL Cumulative Total Grouped
I am trying to create a cumulative total for the Paid column (SUMPaid),
grouped by Contract and Ordered by Year.
T-SQL seed table with auto-incrementing number as part of column value
I have a simple table:
Extract numeric values out of a nvarchar column in SQL
I’m trying to extract the number of gallons out of a string column in SQL. However, I’m not quite sure how to do so since the string column can contain anything. Attached is an image of what I’m dealing with. I managed to write a query that removes everything before the first numerical character (sql below and the “Test” column in the image) however, can’t figure out how to remove everything after the numerical characters in the “Test” column. There’s also a scenario where there isn’t a numerical value at all in the cell, and a date field which I also am not concerned about.
Calculating Absences by hours and days between dates
The following query allows me to calculate in hours (if less than a day – converted to the portion of the day) or days (depending on the length absent), the difference between two dates:
SQL – Calculating Absences by hours and days between dates
The following query allows me to calculate in hours (if less than a day – converted to the portion of the day) or days (depending on the length absent), the difference between two dates:
How to display value correctly between 2 tables
I have two tables that I’m trying to show a flat view from. I have table A with a Product Code and Table B with that Code and a column of Status codes (Done, NotDone, InProcess). That status has a date/time associated with its product code. When I join on the code, I get all the codes regardless if they have a datetime or not. How do I display Product Code, DoneDateTime, InProcessDateTime, NotDoneDateTime in their own columns as a single flat view assuming they datetime code exists?