Skip to content

How to fix H2 Syntax error in SQL statement?

I asked earlier today about replacing a window function because H2 does not support it. I rewrote SQL query but every time I get syntax error in the SQL query (posted below) expected “UNION, …

SQL Sybase – How to display on the same row

Apologies as I’m really new to SQL, and I’m trying to create a code that would extract all values in the same row, in their same respective identifiers (fundno and fund name). What I want is all the …

SQL with conditional where

Could someone please assist with the below query ? I have a table like below : Code alias user ——– —– ——- 7305553 BPP (null) 8136852 BPP AYU 8136852 BPP …

Avoid computing same value multiple times in Presto

Sample Table : ╔═══════════════╗ ║ dummy_data ║ ╠═══════════════╣ ║ XXX_1234_YYYY ║ ║ XXX_5678_YYYY ║ ║ XXX_9101_YYYY ║ ╚═══════════════╝ Desired output : ╔═══════════════╦═════════════╦═════════……

Set NULL value in jooq

I have an big query and my problem is setting NULL values using jooq. For example, I have this piece of sql query: IF(t.PANEL_ID IS NULL, t.ID, NULL) AS testId If transform this into jooq …

Casting to a decimal in SQL

The max value in my table for measure_rate is 572. The below query returns that value. SELECT cast(max(measure_rate) as decimal) FROM [SurgicalMeasures] WHERE measure_rate != ‘N/a’ and …