Skip to content
Advertisement

Flagging column based on condition using SQL

I have a table like this ,

I want to check for Address with respect to X1 , POST is not occurred in X2 then I want to flag with the X1 value as Yes or No.

My output should look like,

Advertisement

Answer

One simple option would be to use aggregation to generate the flags you want, and then join back to your original table:

enter image description here

Demo

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement