Skip to content

Tag: sql

SQL Case statement for impala

I have below requirement in Impala, can someone please help me on this. if table1.column1 is null or empty string ,then table1.column2 else concat(table1.column1,” “,table1.column2) as address Answer Try this

Is there way I can SELECT and JOIN COUNT different queries?

I’m using MYSQL and I have a message table like below. id parent_id sender_id receiver_id content readed sender_deleted receiver_deleted created 18 0 6 1 testab 0 0 0 2021-10-28 01:13:42 19 18 6 1 testcd 0 0 0 2021-10-28 01:14:55 I’m trying to combine two queries in one. Selecting and count where …

Alternative to CASE Statement to Compare and Summarize Data

I have a database that looks like the following; I need to compare the values from each price column and count the matched and mismatched prices and summarize as follows: Required Results I can do this via multiple case statements (below) but I’m wondering if there is a better approach. Current Code: An…

Select only the most recent records by record ID

I have an access database, in it, I have a number of records where I need to pull just the latest information . Here’s the code I am trying to get working : The idea here, is I need 1 Training, and I need just the employees who took that training, and only the last time they took it. Currently