Conditional Select Statment Query


I am using attached query it is working fine.
But now as per my requirement i need some changes in this query.
Rs.Open "Select City,SallNo,Amount,WtDate,Customer,Name,Total,Mode from CityRegion where Name = '" & Text1(11).text & "' and GroupName = 'UAE' and IDTNo = 0 order by SallNo", con, adOpenKeyset, adLockOptimistic

Open in new window


i am getting following result from query.
SYDNEY, 4001, 1000, 07-01-12, SAM, MICHEAL, 1200, CREDIT
SYDNEY, 4002, 1100, 07-01-12, SAM, MICHEAL, 1400, CASH

My desired result should be like this
SYDNEY, 4001, 1000, 07-01-12, SAM, MICHEAL, 1200, CREDIT
SYDNEY, 4002, 1100, 07-01-12, SAM, MICHEAL,       0, CASH

if mode is "CASH"  then Total should be display 0
how can i do that.
LVL 1
Altaf PatniSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sindhuxyzCommented:
You can use case in select clause
Example:
SELECT CASE
            WHEN Obsolete = 'N' or InStock = 'Y'
               THEN 1
               ELSE 0
       END as Salable, *
FROM Product
0
flow01Commented:
or if there is only one value to check

CASE Mode
WHEN 'CASH'  THEN 0
ELSE Total
END


"Select City,SallNo,Amount,WtDate,Customer,Name,CASE Mode WHEN 'CASH'  THEN 0 ELSE Total END Total,Mode from CityRegion where
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.