Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update Hour and Half Hour in a column

Status
Not open for further replies.

Ken

IS-IT--Management
Jul 13, 2005
68
CA
Hi All,

I want to add 2 columns: Hr and Half_Hr and update these column.

Table B: Hours
[pre]Hr, Half_Hr, Time_Start, Time_End
0, 0.1, 12:00:00 AM, 12:30:59 AM
0, 0.2, 12:31:00 AM, 12:59:59 AM
1, 1.1, 1:00:00 AM, 1:30:59 AM
1, 1.2, 1:31:00 AM, 1:59:59 AM
4, 4.1, 4:00:00 AM, 4:30:59 AM
4, 4.2, 4:31:00 AM, 4:59:59 AM
5, 5.1, 5:00:00 AM, 5:30:59 AM
5, 5.2, 5:31:00 AM, 5:59:59 AM
13, 13.1, 1:00:00 PM, 1:30:59 PM
13, 13.2, 1:31:00 PM, 1:59:59 PM
23, 23.1, 11:00:00 PM, 11:30:59 PM
23, 23.2, 11:31:00 PM, 11:59:59 PM
[/pre]

Table A: Transaction_Data
[pre]Item No, TDate, TTime, Qty_Sold Hr Half_hr
1, 1-1-2015, 01:05:00 AM, 5,
1, 1-1-2015, 01:15:00 AM, 7,
1, 1-1-2015, 01:05:00 AM, 5,
1, 1-1-2015, 11:21:02 AM, 7, !
1, 1-1-2015, 11:58:33 AM, 4, !
1, 1-1-2015, 12:59:24 PM, 3,!
1, 1-1-2015, 1:12:56 PM, 2, !
1, 1-1-2015, 1:44:16 PM, 1,!
1, 1-2-2015, 01:54:54 PM, 5, !
1, 1-2-2015, 01:59:16 PM, 9, !
1, 1-2-2015, 02:08:29 PM, 4, !
1, 1-2-2015, 02:39:35 PM, 6, !
1, 1-2-2015, 3:48:14 PM, 3, !
1, 1-2-2015, 12:59:24 PM, 10,!
1, 1-2-2015, 11:32:17 AM, 11,!
1, 1-2-2015, 1:10:25 PM, 2, !
[/pre]
Comma is only added for reference/conversion purpose.

Transaction data will check table B and updated column Hr and Half_Hr

Below query misses value in Hr marked as ?
Code:
SELECT tbl_A.TTime, (select hrs from tbl_B.Hr where (tbl_A.TTime between tbl_B.Time_Start And  tbl_B.Time_End) FROM tbl_A);
Is there way to update the column using Access SQL?

Appreciate your help.

Thks,
TechIT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top