Basically, I have a table that tells about type of communication to accounts(either by letter or email) like : ACOUNT_ID TYPE_OF_COMM 1 Letter 1 Letter 3 EMail 2 Letter 4 EMail 4 Letter and so on.. A query needs to be written that counts : the number of accounts that received letter only, the number of accounts that received mails
Tag: athena
How to print the required output with the help of SQL
I have tables ‘users’ and ‘user_transactions’ in AWS Athena. The table has many columns but I am interested in 2 columns viz. user name and txn_type. The txn_type column has 3 possible values viz. FT, NFT, PT. For each user, I need to print the count of each transactions in the below format. The output should contain 4 columns with
How to concatenate a conditional field and remove the same value
I am trying to create a column with a case statement, then concatenate the column. Here is an example code. Basically, the Action_with_no_date will display the concatenation of values in Action with ‘**’ string added to the values where Date is null for each ID After I did this, I found an edge case. If there is the same Action