Re: SQL Queries Questions
From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 01/28/05
- Next message: Dirk Goldgar: "Re: Trouble with some simple programming"
- Previous message: Kevin Witty: "DoCmd.CopyObject for backend table / Pivot Tables"
- In reply to: Seikyo: "SQL Queries Questions"
- Next in thread: John Vinson: "Re: SQL Queries Questions"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 00:23:32 -0500
"Seikyo" <Seikyo@discussions.microsoft.com> wrote in message
news:FD61A3F1-F49D-4A50-A825-83197B4212AD@microsoft.com
> All the field below are in Date/Time Field. Is there any problem with
> the SQL
> statement below as I got no result printed even though [BEG_WORK] is
> more
> than [SCHD_START]? I am trying to use Update SQL Queries.
>
> I am trying to display the duration of [LATE_HRS] if [BEG_WORK] is
> more than [SCHD_START]. If [BEG_WORK] <=[SCHD_START] Then 0:00 will
> be show.
>
>
IIf(([BEG_WORK]>[SCHD_START]),([LATE_HRS]=([BEG_WORK]-[SCHD_START])),([L
ATE_HRS]="#0:00#"))
You can't perform an assignment like that in SQL. Your expression would
be better framed as:
IIf([BEG_WORK]>[SCHD_START],
([BEG_WORK]-[SCHD_START]),
#0:00#)
Is this expression to be used in an update query? Then the query's full
SQL might look something like this:
UPDATE YourTable SET [LATE_HRS] =
IIf([BEG_WORK]>[SCHD_START],
([BEG_WORK]-[SCHD_START]),
#0:00#);
If you're trying to do it in a SELECT query instead, with [LATE_HRS] as
a calculated field, it might look something like this:
SELECT
*,
IIf([BEG_WORK]>[SCHD_START],
([BEG_WORK]-[SCHD_START]),
#0:00#) AS [LATE_HRS]
FROM YourTable;
-- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup)
- Next message: Dirk Goldgar: "Re: Trouble with some simple programming"
- Previous message: Kevin Witty: "DoCmd.CopyObject for backend table / Pivot Tables"
- In reply to: Seikyo: "SQL Queries Questions"
- Next in thread: John Vinson: "Re: SQL Queries Questions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|