I want to take the difference of the values of 1 column based on version column (only 2 versions) of another column. the id-value pair may exist in one version but not the other and vice versa (in …
InfluxDB placeholder “Empty bound parameter”
I’m struggling to format a InfluxDB query using placeholders. Here I query with multiple placeholders. The values are defined in the placeholders object, as seen below, Once sent, an error 400 – error parsing query: empty bound parameter In the error I can see the GET request, where it appears tha…
How to get overall summary of grouped columns in SQL in a separate column?
I have a grouped query that looks like this that I got from the following query: The Result is the following: How I measure performance is the percentage of times there is a late shipment by a warehouse, so I would like to have a column that shows at the company level the average percentage across every wareh…
Get the sum of rows using sql query
Suppose I have this table structure: I want to sum the quantity for the same name and last name and get the result as below Is it possible to get this result in a single SQL query ? it is easy to get the SUM with the GROUP BY but did not find a way to keep the Buy and
SORT dates that are not in same format – SQL
I have below table and I want to sort it by ascending order. Below command would work except not all of my dates are in correct format. Majority of them are in YYYY-MM-DD and few are in DD/MM/YYYY format. How would i sort them? Can i convert all of them in to on standard format and do the sorting? order
Update a Column of a table after evaluating the status of columns from other tables
I have 3 tables, BaseTable, Test1Table and Test2Table This is what the output should be: So for the above data set: Base Table should be Answer One method uses case and exists:
Case statement with division
I have case statement below as but am getting error on syntax error, is there proper way to divide in case statement? thanks Answer You need to add quotes to the desired column name (if it’s not going to follow traditional naming rules. Change: To: Btw, the exact syntax error you got was Syntax error: u…
Error converting data type varchar to bigint: INSERT INTO SELECT
I keep getting this error when trying to execute a stored procedure and am not sure why: Msg 8114: Error converting data type varchar to bigint. Please see my SQL query below: I believe the error is emerging because of the UniqueStudentID I have tried using CAST & CONVERT around the SELECT line but still …
Convert Date format in SQLite Database
I have a SQLite Database and I mistakenly loaded a lot of data with mismatching date formats. There are dates formatted as: MM/DD/YYYY and dates formatted as: DD-Month Abbr. – YY. I would really like them all to be YYYYMMDD. Is there a way to reformat all of the dates to match the preferred format? Than…
Percentage calculation in SQL
I have some cars in a table along with the year they came out, and I’m trying to calculate the percentages of the cars that belong in the 4 following age groups: 0-4, 5-9, 10-19, 20+. I tried to do this in 3 different ways: 1. I got this error: I got this error: I got this error: Any ideas