I’m trying to write a query that is sort of like a running total but not really. I want to get the previous weight (kg) and keep outputting that for each day until another weight (kg) is recorded then …
Tag: sql
Issue with query in DB2 –Not able to find the cause
I was trying to execute the below query in Db2 and its giving me some error, which I am not able to identify the root cause.Could someone please help here. with test as( select * from ( …
Can I use two values of a foreign key in on table?
I have a ‘users’ table, and there is also a table ‘alerts’. And in the ‘alert’ table, I want to use ‘users.id’ two times representing two different users of a ‘users’ table as a foreign keys in ‘alert’…
Get Values between Each Comma in Seperate Row in SQL Server
I need to insert multiple rows in a database table from a single string. Here is my string it will be comma-seperated values Current string: What I want is that batch 1 should be ignored or removed and remaining part should be added into the SQL Server database as a separate row for after each comma like this…
Filter and Match Column on a List of Substrings
I am attempting to filter a table of user actions on a list of specific actions. For example, given the following data I want all rows where the UserAction contains the strings “Account Creation” or “Attempt to create duplicate account”. I was able to achieve this with the following Li…
pagination and filtering on a very large table in postgresql (keyset pagination?)
I have a scientific database with currently 4,300,000 records. It’s a scientific database, and an API is feeding it. In june 2020, I will probably have about 100,000,000 records. This is de layout of the table ‘output’: BTW, this is dummy data. But output is a table with 5 columns: ID, senso…
MySQL group by week interval on Linux timestamps starting from Sunday
I have a table of users that have joined and the column that tracked the timestamp of when they joined is a UNIX timestamp. I want to group them by a weeks time in seconds, 604800, but am running into a roadblock. The other searches use MySQL week, but that is not what I am after since those weeks are
Django many-to-many: Best way to get elements in one related query set but exclude elements in other related query sets?
Consider these related models: In a view, I need to query to get all Bs related to a given A while excluding all Bs related with a set of other As. I need the grey area: My current, grossly inefficient approach is as follows: In my application, previous_As could have nearly 1,000 elements, which makes this ap…
How to Use Dates in Where Clause in EF Core?
I need to filter my queries by dates but I don’t care in this case about time portion of it that is stored in SQL Database. I first tried to something like var now = DateTime.Now.Date; Where(x => …
I want to echo all classNames that have the same userid in php
code here : I am trying to echo all instances where the userId in the classrooms table is equal to the session userId. HELP. this is the table that we are using to track the users classrooms I’m using mysqli. Turns out, my post is mostly code. So let me give some background details. I’m trying to …