Forum Stats

  • 3,837,409 Users
  • 2,262,256 Discussions
  • 7,900,271 Comments

Discussions

How to generate flag in SQL Developer

MOHAMMAD YASEEN
MOHAMMAD YASEEN Member Posts: 1 Green Ribbon
edited Apr 3, 2022 10:27AM in SQL Developer

I have a cust_no, acnt_no and currency columns, by using this I have to generate a flag on currency, i.e., if the customer is having multiple accounts with different currency then for USD currency I have to make flag as 1 and for others 0, and if the same customer having multiple accounts with the same currency (USD) then only for single account have to make flag 1 and others 0


Cust_no Acnt_no Currency Desired_Output

121 A25 USD 1

121 A26 USD 0

121 A27 INR 0

122 A23 SAR 1

122 A24 SAR 0

123 A12 USD 0

123 A13 INR 0

123 A14 SAR 1

124 A15 INR 0

124 A16 USD 1

125 A17 INR 0

125 A18 PKR 0

125 A19 USD 1

126 A20 USD 1

127 A21 SAR 1

128 A22 ZAH 0

Answers