I migrated a file logger to log to the database instead of to disk. This caused many duplicates in the database, whereas on disk the file would have just gotten overwritten. I want to delete all the “not newest” rows given a specific filename, what SQL would do this given the following table: The …
Tag: sql
AttributeError: ‘NoneType’ object has no attribute ’email’. Flask-sqlalchemy
i’ve a strange problem… i do this: and gives me this problem: Who can help me?? thanks <3 Answer it means it didn’t find any users matching your filter
How to sum the minutes of each activity in Postgresql?
The column “activitie_time_enter” has the times. The column “activitie_still” indicates the type of activity. The column “activitie_walking” indicates the other type of activity. Table example: What I need is to sum up the total minutes for each activity separately. Any sug…
how to split multilinestring into overlapping 2-point subsets (2-point linestrings)?
I want to split a multilinestring or linestring like LINESTRING(0 0, 1 0, 1 1, 0 1) into linestrings consisting of two points. So the linestring above would become: LINESTRING(0 0, 1 0) LINESTRING(1 0, 1 1) LINESTRING(1 1, 0 1) I would also like to be able to do the same with multilinestrings. Answer Use a LA…
How to find out if variable value in database json column Codeigniter?
Im using Codeigniter. Im trying to get some value in database like; the problem is ‘json_value’ column is like = [{“name”:”test1″,”value”:”test1″},{“name”:”test2″,”value”:”test2″}] how can I get ‘…
Powershell sorting columns
I was able to sort the column and remove duplicates using -Unique My problem is that I can’t remove a specific row using the status property ID Name Status 1 John Current 1 John Future 2 Mary Future 2 Mary Notice 3 Paul Future I want the rows to be unique by status order. Current Notice Future Example: …
Compound trigger to insert into another table after insert or update into the main table
I’m working on a compound trigger and I’m having difficulties figuring out how to make it work. The trigger is on the person table. There is a column woman_act. If a new row is inserted and that column is not null than we need to insert that row into the v_changes table or if that column is update…
How do I use ROW_NUMBER in MySQL to check number of rows per day per employee?
I’m storing punch-in and punch-out data in a table that looks like so: id empid punchtime 74 4 2021-08-04 17:11:54 171 4 2021-08-06 13:47:45 202 4 2021-08-09 10:14:01 271 4 2021-08-09 18:20:01 308 4 2021-08-10 11:14:54 343 4 2021-08-10 14:46:21 349 4 2021-08-10 15:22:10 380 4 2021-08-10 18:10:58 406 4 2…
Order by 2 columns with case
I have a query that searches for user in 2 colums firstUser and secondUser and orders them by first and last name: But this first orders the cases when user is at first user then it orders the case when user is secondUser. Is ther a way to order the whole data by first name and last name no matter
Hive Union of two queries is giving compile error
I am not sure what is wrong with following hive query. However, it’s throwing error. I am able to run this queries individually. However, facing issues while running with union Error Answer Hive versions prior to 1.2.0 only support UNION ALL Workaround: Use UNION ALL instead of UNION, wrap all into subq…