🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #1313

Re: Compare Boolean Field

#1313
From: Steve Koterski
Date: Mon, 02 Mar 1998 00:00
41 lines
1902 bytes
On Mon, 02 Mar 1998 17:26:49 +0800, Wilson Woo <wilson00@hk.super.net>
wrote:

>I'm using Delphi TTable & TQuery components to select table records.
>The table is used to store staff information.
>There is a field named 'ACTIVE', which is Boolean type, to reveal that
>the staff is working or resigned ('ACTIVE' = True for working).
>
>My question is how to use SQL to select all staff that is working
>('ACTIVE' = True)?
>
>I have tried:
>
>  select * from STAFF where 'ACTIVE' = True
>
>but no record returned.
>
>The table, STAFF.DBF, is a Fox Pro database.

Could be that putting that column name in quotes is throwing it off. Try
prefixing it with the table name or a table correlation name. This way, the
SQL parser will be sure that you are trying to compare a column, and not a
string, to True.

  SELECT *
  FROM "STAFF.DBF" S
  WHERE (S."ACTIVE" = True)

In local SQL, a boolean literals are True and False, and may be expressed
with or without quotation marks.

  SELECT *
  FROM "STAFF.DBF" S
  WHERE (S."ACTIVE" = True) OR (S."ACTIVE" = "False")

**************************************************************************
Steve Koterski
Borland International, Inc.
http://www.borland.com/delphi
(Remove the "SPICEDHAM2" from the address. Death to spam-bots!)
Technical Details
Message-ID: <34faec03.3814313@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34FA7B59.5683@hk.super.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,ea61e9b41b41e3d6
X-Google-Attributes: gidff5a1,public
From: koterski@SPICEDHAM2borland.com (Steve Koterski)
Subject: Re: Compare Boolean Field
Date: 1998/03/02
Message-ID: <34faec03.3814313@forums.borland.com>
X-Deja-AN: 330066578
Content-Transfer-Encoding: 7bit
References: <34FA7B59.5683@hk.super.net>
Content-Type: text/plain; charset=us-ascii
Organization: Borland International, Technical Publications
Mime-Version: 1.0
Reply-To: koterski@SPICEDHAM2borland.com
Newsgroups: borland.public.vdbase.data.sql