hana-sql-script

how to join, if the text contains

拜拜、爱过 提交于 2021-01-28 08:10:10
问题 I have 2 tables, say table A has 10 rows and table B has 100 rows and I want to perform a join, but the matching condition has to be where a column from A 'is like' a column from B meaning that anything can come before or after the column in B: For example: if the column in A is 'foo'. Then the join would match if column in B is either: 'fooblah', 'somethingfooblah', or just 'foo'. I know how to use the wildcards in a standard like statement, but am confused when doing a join. Does this make

Does SQLScript for SAP HANA support the use of INSERT with CTEs (Common Table Expressions)?

旧城冷巷雨未停 提交于 2020-03-25 21:23:05
问题 I know this isn't a specific bit of code or problem, but I am having trouble with a very similar issue to the person asking this (except theirs is for SQL Server): Combining INSERT INTO and WITH/CTE ...and I can't seem to find it out there on any SAP HANA help forums etc. so thought there may be an expert on here who can just give me a simple yes or no answer. The SQL statement I am using contains multiple CTEs, but when I try to insert it tells me there is a Syntax error around the word

SQL capped, continuous sum

帅比萌擦擦* 提交于 2020-01-01 06:46:53
问题 Assume a time series where we have one value per point in time. I have to calculate a continues sum by calculating the current value + the sum of the previous value. Tricky part however is, that the sum should be capped and hence not exceed a certain value. Example: Sum is capped at +2. +-----+---------+------------+ | row | measure | capped sum | +-----+---------+------------+ | 1 | 1 | 1 | | 2 | 3 | 2 | | 3 | 4 | 2 | | 4 | -2 | 0 | | 5 | 1 | 1 | +-----+---------+------------+ e.g. the

Conditional update on Hana Studio (SQL Script) trigger

核能气质少年 提交于 2019-12-11 18:15:14
问题 I have two example tables: TABLE1: ID | COLUMN_B| COLUMN_C _________|_________|_________ 1 | 0 | 1 ________|_________|_________ 2 | 0 | 1 ________|_________|_________ 3 | 0 | 1 TABLE2: ID | COLUMN_E| COLUMN_F ________|_________|________ 1 | Y | X ________|_________|_________ 2 | Y | X ________|_________|_________ 3 | Y | X What I would like to do is to write a trigger on Hana Studio using SQL Script to update column E from table 2 when column B from table 1 is updated to a specific value (let

Cumulative Sum grouped by multiple parameters

风格不统一 提交于 2019-12-11 17:25:57
问题 I need Cumulative sum for 'Order Qty'. When i use this code with Select fields as "Sales_Year","Sales_Billing_Date", "Order_Qty" am getting the result i needed. Code used: "Sales_Year", "Sales_Billing_Date", "Order_Qty" , SUM ("Order_Qty") OVER ( ORDER BY "Sales_Billing_Date") AS "SUM_VAL" FROM ( SELECT "Sales_Year", "Sales_Billing_Date" , SUM("Order_Qty") AS "Order_Qty" FROM "PS_WARRANTY_ANALYTICS"."PS_PAL_DLR_SALES" GROUP BY "Sales_Year","Sales_Billing_Date" ) But i select more fields(added

SQL capped, continuous sum

强颜欢笑 提交于 2019-12-03 20:53:38
Assume a time series where we have one value per point in time. I have to calculate a continues sum by calculating the current value + the sum of the previous value. Tricky part however is, that the sum should be capped and hence not exceed a certain value. Example: Sum is capped at +2. +-----+---------+------------+ | row | measure | capped sum | +-----+---------+------------+ | 1 | 1 | 1 | | 2 | 3 | 2 | | 3 | 4 | 2 | | 4 | -2 | 0 | | 5 | 1 | 1 | +-----+---------+------------+ e.g. the "capped sum" of row 4 is calulated using the "capped sum" from the previous row, "2", and adding the current