Skip to content

Tag: sql

PostgreSQL cross join using max returns null

I want to select the max() value of the modified_at column in each of several tables: This works correctly as long as each of the tables has at least 1 row. The problem is that when just one of the tables has 0 rows, null is returned for all tables: What is a solution that returns the correct values for

How can I retrieve an updated script in the oracle database?

How can I retrieve an updated script in the oracle database? An incorrect script was run in the oracle database. I want to get this script back. how can I do that? The script is as follows. Answer If you haven’t COMMITted the data then use ROLLBACK. Otherwise, your solution could be as simple as running…

How to get row count based on other column groups

I need to count the number of dates with which the invoices are made to certain customers in each month Consider the table named Table1 I tried the folllowing code and the result was The result I need should count the column named branch based on column month, the desired result is Here rowcount is based on b…