Skip to content

Tag: postgresql

Simple PostgreSQL Self Join

This is what my employee table looks like where manager_id is Foreign Key to the same table it references to employee_id and indicates which employee has manager and who is. I did self left join and the result was what was expected. But this query gives me So I don’t understand why it returns something …

Sql memory issue

I have created a new postgres server and when I trying to execute this sql command: table1 and table2 contains around 300 000 records I got an error like this: Any ideas ? Regards, Arrmlet Answer Your join conditions are probably not correct. You can calculate how many rows there are by using: My guess is tha…

How to fetch the the second row

I have a query below which is used to make a view. This query pulls the latest record of the report_id. One report_id can have multiple unique report_info_id This results in data something like Lets take the example of last record where report_id= 130 Now it is required that in first query I want such data if…