What I need to do is pretty simple. I just need to update a DATE field in SQL to a PM time. Only thing is, if I use the TO_DATE function to update to an AM time, no problem… However if I try to do the same thing to set to a PM time using military time… It says that
Tag: sql
Reset ROW_NUMBER() when previous partition ID changes
I am trying to reset the ROW_NUMBER() value when there is a change in one of the IDs when sequenced in datetime order. For example in the table below, when Location_ID changes, I want to reset the RowNum to 1. Here’s the statement I am using. I get RowNumX, but want RowNumY. EventDate Scan_Timestamp Ass…
Combine cells in access separated by comma
I am new to access and coding. I have a sheet comprising of huge data. I want some specified data in Access by running a query or VBA. What I want is to combine the data based on a column and each data separated by a comma. I am pasting the example of the sheet below: Input sheet Output data
PostgreSQL – Does a ‘RETURNING ELSE’ statement exist for an UPDATE?
I have this query: When the update is successful, it returns the following: client_id username isSuccess 1 test_name 1 When the update doesn’t execute, it returns client_id, username, and isSuccess, but their values are blank. What I’m having trouble with is customizing what returns when NO update…
how to insert pandas dataframe into IN operator of SQL
I have pandas dataframe with unique number of user: I want to pass this column to sql query where I use IN operator: I have tried doing this which would retrun whith this ‘1qw3,2wed,3das,4frr,533ew,612w’ and then something like WHERE users in STRING_SPLIT(data_frame, ‘,’) but this one …
ASP classic select date BETWEEN dates on SQL Server
I run the next query in my classic asp code and it run perfect. it returns results between the days “from” and “to” However,I cannot find out what is wrong with the next query: I want it to return the results of the last week that are recorded in the database. Any Ideas? The query is o…
Postgres Calculating Weighted Average
I am trying to get the weighted average of items from this example table: Item Value Item1 0.10 Item2 0.15 I followed this example here how to calculate it: https://www.wikihow.com/Calculate-Weighted-Average And tried this statement: I am trying to get the average by doing SUM(numberXWeightingFactor) but it d…
SQL – How to print calculated datetime result
If a.modified_datetime is ‘2021/10/01 13:00:00’ and b.modified_datetime is ‘2021/10/01 12:30:00’, the result of this query would be: However, I run this query via sqlplus, it returns What’s wrong with this query, or need to set some options to sqlplus? Answer it is stored in a da…
C# select SQL query with parameter
I would like to migrate database from MS Access to SQL Server and I’m trying to modify my SQL queries. In MS Access they worked. I have this C# code: Connection method : SQL query is working but not returning rows. I guess that problem is a syntax of parameter in query. Can someone direct me? Answer You…
Get percentage of total using sub selection
I have a query that sums sold units and groups them by store. See code and/or SQL-fiddle below: http://www.sqlfiddle.com/#!5/95f29/6 However, I also want the percentage sold by each unit to the total and have therefore created a column named “sold_total”. After the output of this query is generate…