Skip to content

Tag: sql

Postgresql query between date ranges

I am trying to query my postgresql db to return results where a date is in certain month and year. In other words I would like all the values for a month-year. The only way i’ve been able to do it so far is like this: Problem with this is that I have to calculate the first date and last

Stored procedure to return count

I am trying to make a stored procedure for the query I have: or I have written this stored procedure but it returns count of all the records in column not the result of query plus I need to write stored procedure in plpgsql not in SQL. Help me write this type of stored procedure in plpgsql which returns retur…

INSERT or UPDATE from another table in mysql

I have two tables, with same schema – create table test1 ( a INT NOT NULL , b INT NOT NULL , c INT, PRIMARY KEY (a,b) ); create table test2 ( a INT NOT NULL , b INT NOT NULL , c INT, PRIMARY KEY (a,…