Skip to content

How to create a pivot tablefor this problem:

This is my original table: Original table And I would like it to be as: CityID | 1 | 2 | 3 | 4 | 5 | 6 | 7 _____________________________________ 1024 0800 0900 and so on… Here is my code, but I …

How to identify pattern in SQL

This is my table. It does consist of A,B and C columns. Only one column value will be true at one time. My task is to identify pattern based on latest five rows. For example I need to search entire …

Apply SUM( where date between date1 and date2)

My table is currently looking like this: I’m trying to sum values of ‘ON_Prepaid’ over the course of 7 days, let’s say from ‘2020-01-01’ to ‘2020-01-07’. Here is what I’ve tried Things should be fine if the dates are continuous; however, there are some mis…

R2DBC support in Jooq for Reactive applications

Currently I have written my project using spring boot + hikari connection pool, and fetching the result using fetchAsync method. But according to this documentation Reactive fetching, its Blocking …

Is there any way to join two queries without common columns

Could anyone help me to join two tables without common columns? I have two tables: Tab1 Column1 Column2 K1 a K2 b Tab2 Column1 Column2 K3 c K4 d K5 e The result of select should be: Table1.Column1 Table2.Column1 K1 K3 K1 K4 K1 K5 K2 K3 K2 K4 K2 K5 How do I do that? Answer Fiddle -> https://www.db-fiddle.co…

Why current_date() incurr errors in postgres sql

I have sql like following. But it returned following errors Syntax error at or near Line 19, Position 35 This error was caused by current_date(). How can I avoid this and how can I get current date ? If someone has opinion,please let me know Thanks Answer date_sub() function is only available in Mysql , and c…