PC Review


Reply
Thread Tools Rate Thread

To apply trucate in select statement

 
 
pol
Guest
Posts: n/a
 
      23rd Dec 2009
I have the following data in table

Worktime
---------------
5.30
6.40
3.15
5.55

How I give trucate function in select statement. ie,
select sum(trucate(worktime,60)) ....

Please help


 
Reply With Quote
 
 
 
 
PvdG42
Guest
Posts: n/a
 
      23rd Dec 2009

"pol" <(E-Mail Removed)> wrote in message
news:C67DCA08-A754-4434-94E0-(E-Mail Removed)...
> I have the following data in table
>
> Worktime
> ---------------
> 5.30
> 6.40
> 3.15
> 5.55
>
> How I give trucate function in select statement. ie,
> select sum(trucate(worktime,60)) ....
>
> Please help
>
>


Perhaps if you could describe what happens when you attempt your query? Do
you get unexpected results, or an error message? Please describe the results
in detail. While you're at it, please provide full query text. "...."
doesn't tell us much.


 
Reply With Quote
 
Daryl S
Guest
Posts: n/a
 
      23rd Dec 2009
Pol -

By truncate, I assume you mean you want to display only the integer portion
of the results (whole hours only excluding any minutes). If so, use
Int([Worktime]). You can sum the records with Sum(Int([Worktime])), which
will truncate each value first, then sum the results.

This assumes these are number fields with decimal time (e.g. 1.5 = one hour
and 30 minutes), as that is the format in your post.
--
Daryl S


"pol" wrote:

> I have the following data in table
>
> Worktime
> ---------------
> 5.30
> 6.40
> 3.15
> 5.55
>
> How I give trucate function in select statement. ie,
> select sum(trucate(worktime,60)) ....
>
> Please help
>
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      23rd Dec 2009
On Wed, 23 Dec 2009 07:56:01 -0800, pol <(E-Mail Removed)> wrote:

>I have the following data in table
>
>Worktime
>---------------
>5.30
>6.40
>3.15
>5.55
>
>How I give trucate function in select statement. ie,
>select sum(trucate(worktime,60)) ....
>
>Please help
>


There is no Trucate() (or even a Truncate) function in Access, so it clearly
won't work as written!

What is the datatype of Worktime? What are you expecting Trucate to return?
What is the meaning of the 60 argument?
--

John W. Vinson [MVP]
 
Reply With Quote
 
pol
Guest
Posts: n/a
 
      24th Dec 2009
The datatype is numeric with decimal 2. If I want integer part and decimal
part.
for example from the following

8.50
8.30

I have to get the value 8 from both record. So which function can I give to
get integer portion.




"John W. Vinson" wrote:

> On Wed, 23 Dec 2009 07:56:01 -0800, pol <(E-Mail Removed)> wrote:
>
> >I have the following data in table
> >
> >Worktime
> >---------------
> >5.30
> >6.40
> >3.15
> >5.55
> >
> >How I give trucate function in select statement. ie,
> >select sum(trucate(worktime,60)) ....
> >
> >Please help
> >

>
> There is no Trucate() (or even a Truncate) function in Access, so it clearly
> won't work as written!
>
> What is the datatype of Worktime? What are you expecting Trucate to return?
> What is the meaning of the 60 argument?
> --
>
> John W. Vinson [MVP]
> .
>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      24th Dec 2009
Use Int or Fix (check the VBA help for differences in the behavior of the two).

Int(8.75) will return 8
Int(-8.75) will return 9

Fix(8.75) returns 8
Fix(-8.75) returns 8

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

pol wrote:
> The datatype is numeric with decimal 2. If I want integer part and decimal
> part.
> for example from the following
>
> 8.50
> 8.30
>
> I have to get the value 8 from both record. So which function can I give to
> get integer portion.
>
>
>
>
> "John W. Vinson" wrote:
>
>> On Wed, 23 Dec 2009 07:56:01 -0800, pol <(E-Mail Removed)> wrote:
>>
>>> I have the following data in table
>>>
>>> Worktime
>>> ---------------
>>> 5.30
>>> 6.40
>>> 3.15
>>> 5.55
>>>
>>> How I give trucate function in select statement. ie,
>>> select sum(trucate(worktime,60)) ....
>>>
>>> Please help
>>>

>> There is no Trucate() (or even a Truncate) function in Access, so it clearly
>> won't work as written!
>>
>> What is the datatype of Worktime? What are you expecting Trucate to return?
>> What is the meaning of the 60 argument?
>> --
>>
>> John W. Vinson [MVP]
>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select statement after the sqldataadapter Update statement Igor Microsoft ADO .NET 6 19th Dec 2007 06:44 AM
Correct syntax for SELECT statement within a SELECT statement. =?Utf-8?B?R3JlZw==?= Microsoft Access ADP SQL Server 2 16th Oct 2006 09:20 PM
select statement into if statement in an event code (syntax error =?Utf-8?B?dG90YQ==?= Microsoft Access VBA Modules 1 12th Dec 2004 11:13 AM
SQL statement to insert a value generated by a SELECT statement? Rob Richardson Microsoft ADO .NET 2 21st Feb 2004 04:26 PM
SELECT INVALID SELECT STATEMENT TO FORCE ODBC DRIVER TO UNPREPARED STATE Jason Teng Microsoft Windows 2000 2 28th Oct 2003 06:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:50 PM.