General
Non null value associated with least value in other column
On December 14, 2021 by BabilessMy data is like:
Desired output:
I have tried using following lines:
CASE WHEN (MINDAY_DIFF > 0) AND (MINDAY_DIFF IS NOT NULL) THEN FIRST_VALUE(BP_MED) OVER(PARTITION BY ID ORDER BY MINDAY_DIFF ASC) END AS DRUG
It gave me NULLS.
I also tried
CASE WHEN (MINDAY_DIFF > 0) THEN BP_MED ELSE NULL END AS DRUG
It gave me both non-null values of BP_MED.
I also tried NVL but that didn’t work as well.
Since it is in Netezza. There are fewer solutions online. Please help.
You may also like
Recent Posts
- Inside AllWinAcademy.com: Sai Donti’s Visionary Approach to Automated Trading Education
- Shining Bright: The Leadership Journey of CEO John Smith at Novita Diamonds
- Lab Diamond Wedding Bands: The Ethical, Sustainable Choice for Your Forever Symbol of Love
- The Pros and Cons of Different Diamond Shapes
- Lab-Grown Diamond Necklaces: Sparkle with Sustainability
- Ring Sizes: The Ultimate Guide
- Florida Bankruptcy Attorney: Your Path to Financial Recovery
- Dallas PR Firms: Your Guide to the Top Public Relations Experts in the Metroplex
- Platinum vs Gold Lab Diamond Rings: Choosing the Perfect Ring for Your Special Occasion
- The Ultimate Guide to Custom Engagement Rings with Lab Created Diamonds
- Arlington Heights Criminal Lawyer: Expert Defense Services in Your Area
- Benefits of Gratuity Calculator In Brief
- Learn About a Good Workers Compensation Lawyer
- Why Your Marketing Needs a Unique Appearance
- Essential Software Categories for Contemporary Business Operations
Popular Posts
- Inside AllWinAcademy.com: Sai Donti’s Visionary Approach to Automated Trading Education
- Shining Bright: The Leadership Journey of CEO John Smith at Novita Diamonds
- Lab Diamond Wedding Bands: The Ethical, Sustainable Choice for Your Forever Symbol of Love
- The Pros and Cons of Different Diamond Shapes
- Lab-Grown Diamond Necklaces: Sparkle with Sustainability
- Ring Sizes: The Ultimate Guide
- Florida Bankruptcy Attorney: Your Path to Financial Recovery
- Dallas PR Firms: Your Guide to the Top Public Relations Experts in the Metroplex
- Platinum vs Gold Lab Diamond Rings: Choosing the Perfect Ring for Your Special Occasion
- The Ultimate Guide to Custom Engagement Rings with Lab Created Diamonds
- Arlington Heights Criminal Lawyer: Expert Defense Services in Your Area
- Benefits of Gratuity Calculator In Brief
- Learn About a Good Workers Compensation Lawyer
- Why Your Marketing Needs a Unique Appearance
- Essential Software Categories for Contemporary Business Operations
Most viewed Posts
- Inside AllWinAcademy.com: Sai Donti’s Visionary Approach to Automated Trading Education
- Shining Bright: The Leadership Journey of CEO John Smith at Novita Diamonds
- Lab Diamond Wedding Bands: The Ethical, Sustainable Choice for Your Forever Symbol of Love
- The Pros and Cons of Different Diamond Shapes
- Lab-Grown Diamond Necklaces: Sparkle with Sustainability
- Ring Sizes: The Ultimate Guide
- Florida Bankruptcy Attorney: Your Path to Financial Recovery
- Dallas PR Firms: Your Guide to the Top Public Relations Experts in the Metroplex
- Platinum vs Gold Lab Diamond Rings: Choosing the Perfect Ring for Your Special Occasion
- The Ultimate Guide to Custom Engagement Rings with Lab Created Diamonds
- Arlington Heights Criminal Lawyer: Expert Defense Services in Your Area
- Benefits of Gratuity Calculator In Brief
- Learn About a Good Workers Compensation Lawyer
- Why Your Marketing Needs a Unique Appearance
- Essential Software Categories for Contemporary Business Operations