Showing posts with the label sql

[FIXED] Parsing out inconsistent data to grab specific year

Issue I have a TableA with a column Years . Each row value in this column is formatted as a mix

[FIXED] execute sql inside plpgsql function

Issue Using postgreSQL 9.1.9, I have some SQL requests like this: INSERT INTO "my_table&quo…

[FIXED] Extremely weird hibernate search issue

Issue I'm having a hard time thinking how to provide a reproducible example, because there are …

[FIXED] Best way to select random rows PostgreSQL

Issue I want a random selection of rows in PostgreSQL, I tried this: select * from table where ran…

[FIXED] Primary key: a string or number (id)?

Issue I am aware of benefits of using integers (amount of space, performance, indexes) as primary k…

[FIXED] query to remove everything between 1st and 2nd hypen for string in column

Issue I am trying to retrieve records based on a custom field " ci_ku ". For the same val…

[FIXED] Summing column that is grouped - SQL

Issue I have a query: SELECT date, COUNT(o.row_number)FILTER (WHERE o.row_number > 1 AND date…

[FIXED] How to sort table names only if they have the same value in a numeric field?

Issue I have made the following table with SQL: CREATE TABLE facts ( id INTEGER PRIMA…

[FIXED] psql invalid command \N while restore sql

Issue I'm trying to restore my dump file, but it caused an error: psql:psit.sql:27485: invali…

[FIXED] Return values contained in given array - or all values if no match

Issue Given an array literal as a parameter, and a table expression as (pseudo-code-like): SELECT …

[FIXED] How to Query with multiple conditions on same field in Rails

Issue I have this array: cars = ["green", "blue", "red", "yello…

[FIXED] Delete duplicate rows (don't delete all duplicate)

Issue I am using postgres. I want to delete Duplicate rows. The condition is that , 1 copy from the…

[FIXED] Sum over partition reset when running total is 0

Issue I have a query that is taking transactions (buying and selling of items) to calculate the gai…

[FIXED] How can i go about creating this complex SQL query?

Issue I Have a table that looks like this: Table1 : Time_stamp bigint, << Notice this is bi…

[FIXED] how to compare and extract 2 columns PostgreSQL

Issue I want to extract colums that different in fruit colum but have a same value in fruit_id colu…

[FIXED] How to I get the date of birth from a full age in postgresql?

Issue I have an age on the format 57 years 5 months 7 days , and I want to deduct the date of birth…

[FIXED] Filtration on columns created using CASE Postgresql

Issue I have a table below: id int user_id int created_at datetime status varchar type varchar an…

[FIXED] SQL query result is not showing in R odbc

Issue I am trying to run a simple query using R which is listed below. I am connected to odbc and i…

[FIXED] SQL count using column of date before and after

Issue ID type center;">date Odertime 1 A 2022-03-02 2021-06-23 2 A 2022…

[FIXED] Finding unique number of logins from a database based on two columns

Issue I have a database with information of when users have logged into my app. There are two colum…