How to correctly call a function in PostgreSQL
I have created a function that does not give any errors itself but when calling it I get an error. I know I technically don't need a function but for my scenario I need to be using one. The error:…
I have created a function that does not give any errors itself but when calling it I get an error. I know I technically don't need a function but for my scenario I need to be using one. The error:…
I have very simple table: create table tmp( id int, source_id int, event_user varchar, event_date timestamp ); and here is the data: insert into tmp(id, source_id, event_user, event_date) values (1, 1, 'A', now()), (2, 1, 'A', now()+interval '1 day'), (3,…
I have data defined as double saved in a PSQL-Database (Actian) and I'm using DbDataReader to read the values. I know I can use GetDouble to read the value, but I would like read the raw value into a byte…
I am having an sql view "data", which looks like the following: CALMONTH COSTCENTER Kontonummer FIELDNM003 202212 Alpha 123 10 202301 Alpha 123 20 202210 Alpha 223 50 202307 Beta 123 10 I want to keep only the combinations of…
I have the below table: s.userid c.userid c.action 3 3 timeout 3 3 timeout 7 7 confirmed 7 7 confirmed 7 7 confirmed 2 2 timeout 2 2 confirmed For a given s.user_id, I am trying to calculate count(confirmed)/ (count(confirmed)…
Requirement: To select entries relating to an account where delivered after date x, returned between dates y and z and also where returned is null. I've attempted to use the following and it selects everything delivered before the stipulated date…
Imagine I have rows of data in a postgres table, such as: Id Value 1 User_1 2 Region_3 3 User_2 And I want to select out values in a way that uses the part of Value before the _ character…
With a schema: CREATE TABLE foo ( id SERIAL UNIQUE, name VARCHAR(15) NOT NULL, domain VARCHAR(255), ); CREATE TABLE bar ( foo_id INT UNIQUE NOT NULL REFERENCES foo(id), passphrase VARCHAR ); I need to use: SELECT * FROM foo LEFT…
I am trying to avoid duplicate entries in the table based on type and names however the unique constraint not getting applied. CREATE TABLE IF NOT EXISTS test ( id integer NOT NULL DEFAULT nextval('threshold_retry.threshold_details_id_seq'::regclass), component_type text COLLATE pg_catalog."default" NOT…
I have created a warehouse inventory report page. I'm trying to calculate average price of every item present in our warehouse. The items have different price and quantity every time we purchase. For eg. we purchased 10 bottles of water…