Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Select Clause in Interbase

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
If I´d need to use something like the following sentence working with Interbase 6:

Select case
when A.Occupation='Pre' then 'President'
when A.Occupation='Sal' then 'Sales Man'
end
from employee A

How should I proceed to do that? Please, help me quickly becouse this is an emergency.
 
I don't believe you can do anything like that with SQL. You could use the OnGetText event of the TField to change Pre to President and Sal to Sales Man, so that they would display appropriately in a dbgrid.

Hope that helps! TealWren
 
Oh - forgetting what forum I am in. :) What dev language are you using? That approach would work with Delphi and probably C++ Builder. TealWren
 
If you try this sentence in the Sql Server I´m sure this SQL will work. May be there is a minimal syntax error, but the idea is that one.

Thank you very,very much for your help.I wouldn´t like to solve this problem via programation, but I think there is no different way using Interbase 6.0.What a shame!!!

Robert Tempest.
 
For an SQL based solution you might make another table that you could join with this table to translate the abbreviations. That would work in both Interbase and SQL server. TealWren
 
Do you want to change the value of occupation?

Try one first, then the other. Check in the pdf guide from interbase at altering tables

Regards S. van Els
SAvanEls@cq-link.sr
 
Hey, I have just posted a similar problem on the thread. Really, in MS SQL, your Case statement works. In Oracle, I believe you use the DECODE instead of CASE. I really just wonder how to do it in Interbase??

Please, Mr. Robert Tempest, if you had the solution to this problem, let me know.

SilverStray
jechavez@idsfinance.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top