Category "case"

SQL query - How to increase the salary of employees, without exceeding a certain salary limit

I am trying to get a query that will allow me to increase the salary of people who earn less than 2000, but I don't want the salary increase for these people to

Create a postgresql function that returns a string 'fall', 'spring' depending on year

I need to create a function that returns the string 'fall' or 'spring' depending on the month of the year. If the function was named getterm and took no paramet

Grouping Nested Query BY CASE OF ALIAS

I am trying to use a GROUP BY statement that would count each of the progress grades: SELECT with_avg.*, CASE when T_Points = Average then 'On Target' when T_P

Two-part conditional sql statement

The statement below is querying a log table and I'm trying to get the max budget depending on the scenario if falls within. Error message: Expressions referenc

How to make case in HANA

I have the following query in postgres which gives the meter range and the number of vehicles travelled between the range SELECT (CASE WHEN meter >= 0 AND m

How to select non-NA values for each ID if present otherwise select NA in Oracle?

I have a df which can have single/several rows per ID. If it has multiple rows, only 1 row is populated with a non-NA value for a column. Sometimes all rows are

sqlite mark duplicates with true or false

I need to create a new column in my dataset (duplicate_name) that contains TRUE if there are more than one record for someone or FALSE otherwise. I found this c

CASE statement in Netezza

I am new to Netezza so may be I am not able to figure out the issue. I have a scenario to implement in informatica with Netezza as the database. As few functio

GROUP BY + CASE statement

I have a working query that is grouping data by hardware model and a result, but the problem is there are many "results". I have tried to reduce that down to "