Solved

SQL EASY QUESTION ?

Posted on 2004-03-25
7
202 Views
Last Modified: 2010-04-05
I want this instruction  give me string result not Boolean value

Select  table1.booleanfield where table1.name=jone

What I want is : if booleanfield = true then the result of  instruction is ‘ good ‘
                           if booleanfield = false then the result of  instruction is ‘ bad ‘

I am waiting your  for your help .
0
Comment
Question by:peruzzi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:concon
ID: 10675501
Hi peruzzi,

what is your db? if sql/server :

select case(booleanfield
            when true then 'good'
            when false then 'bad'
            end) from table1 where name='jone'

Regards.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10675517
there is a TBooleanField,
which should be automatically
assigned to your table-boolean field

there is a property DisplayValues
add there good;bad

meikl ;-)
0
 
LVL 6

Accepted Solution

by:
wimmeyvaert earned 20 total points
ID: 10676125
I think kretzschmar has it right.

Some more explanation :

If you doubleclick your TTable-Component in Delphi IDE, then do CTRL-F to add all fields linked to the Table you provided in TableName-property of your TTable.

Now you should see the BooleanField between all the other fields. Click on this field an go to the Object Inspector. change the Property 'DisplayValues' into good;bad.

If you now drag and drop this BooleanField from the FieldEditor (doubleclicking on TTable) to your Form, you should see 'good' if this field contains True and 'bad' if the field contains 'False' at runtime.

Hope I was of some help. Anyway the Kretzschmar had the right answer to your Q. I just tried to clarified the way of working.

Best regards,

The Mayor.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 10676164
This also works for a TQuery-component !!
0
 

Author Comment

by:peruzzi
ID: 10679109
Hi guys
wimmeyvaert , I choose your answer
I wanted to spilt the points between you and kretzschmar but I could not
so I choose the useful answer for me and give it the point.
 thank thanks for all
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10679675
hi peruzzi,

this is ok

wimmeyvaert explains it complete, so he earnes the points.
i'm not worry about this.

good luck again

meikl ;-)
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 10684819
Hi all,

Kretzschmar, thanks you are ok with it.
It was not my intention to steel the points from you. I just explained in detail what you suggested.
Long live the fairness !!!

Thanks again,

The Mayor.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question