Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Update Query to Divide Amounts in Table by 100

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
orbojeff - 20 Nov 2005 23:27 GMT
A field in my Table contains Dollar Amounts that are off; instead of
12.44, it's 1244
Therefore I would like to divide this field by 100

I want to permanently modify the Table, no create a separate Table
I was told the best way to do this is with an Update Query

I'm unfamiliar with this type of query.
Can someone send me a high level summary or an example

Thanks
Jeff
Chris2 - 20 Nov 2005 23:59 GMT
> A field in my Table contains Dollar Amounts that are off; instead of
> 12.44, it's 1244
[quoted text clipped - 8 lines]
> Thanks
> Jeff

Jeff,

The basic syntax of an UPDATE query is as follows.

UPDATE <table>
  SET <column>
     |,<column>...|
WHERE <criteria>

Example

CREATE TABLE OrderDetails
(OrderDetailID     AUTOINCREMENT
,OrderID           INTEGER
,OrderPlaced       DATETIME
,ProductID         INTEGER
,Quantity          INTEGER
,CONSTRAINT pk_OrderDetails PRIMARY KEY (OrderDetailID)
)

Note: The FOREIGN KEY CONSTRAINTs for OrderID and ProductID have
been omitted for brevity.

Sample Data:

1, 5, 10/29/2005, 10, 1

Query:

UPDATE OrderDetails
  SET Quantity = 20
WHERE OrderID = 5
  AND ProductID = 10

Output:

1, 5, 10/29/2005, 10, 20

In your case, it would be:

UPDATE UnknownTable
  SET DollarAmount = (DollarAmount / 100)
WHERE <criteria>

As always, backup your data first . . .

Sincerely,

Chris O.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.