Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-19-2019, 03:45 PM   #1
Arvive
Newly Registered User
 
Join Date: Aug 2019
Posts: 13
Thanks: 11
Thanked 0 Times in 0 Posts
Arvive is on a distinguished road
Insert Query

How to insert data into the second table horizontally. Kindly assist

from

ID EMPID HEADID Compcode Compname Amount datetim
44 120 3 3 Basic 300 17-Aug-19
45 120 3 2 Attendance 250 17-Aug-19
46 120 3 3 Health Insurance 100 17-Aug-19
47 120 3 8 Loan 100 17-Aug-19
48 120 3 9 Advance Salary 50 17-Aug-19

to
Date EMPID Basic Attendance Health Advance Salary Loan
17-Aug-19 120 300 100 250 50 100

for further manipulation.
Thank you.

Arvive is offline   Reply With Quote
Old 08-19-2019, 03:59 PM   #2
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,617
Thanks: 1
Thanked 628 Times in 621 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Insert Query

Build a CROSSTAB query.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
June7 is offline   Reply With Quote
Old 08-19-2019, 03:59 PM   #3
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 2,044
Thanks: 39
Thanked 643 Times in 592 Posts
MajP has a spectacular aura about MajP has a spectacular aura about
Re: Insert Query

You can try (my table is called objectType)
Code:
TRANSFORM First(ObjectType.[Amount]) AS FirstOfAmount
SELECT ObjectType.[datetime], ObjectType.[EMPID]
FROM ObjectType
GROUP BY ObjectType.[datetime], ObjectType.[EMPID]
PIVOT ObjectType.[Compname];
I get
Code:
datetime	EMPID	Advance Salary	Attendance	Basic	Health Insurance	Loan
17-Aug-19	120	50	250	300	100	100

MajP is offline   Reply With Quote
The Following User Says Thank You to MajP For This Useful Post:
Arvive (08-21-2019)
Old 08-21-2019, 03:35 AM   #4
Arvive
Newly Registered User
 
Join Date: Aug 2019
Posts: 13
Thanks: 11
Thanked 0 Times in 0 Posts
Arvive is on a distinguished road
Re: Insert Query

Thanks @MajP

Arvive is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
INSERT query does not insert all data in query marlan Queries 32 09-17-2015 01:35 PM
how to insert from a query to a table when the query is changed mana Queries 1 07-14-2015 12:48 PM
[SOLVED] How to insert a prompt for a # in a query to calculate against another field in query Lilly420 Queries 9 07-15-2014 11:06 AM
Query to insert missing rows from another query/table baseballrock17 Queries 2 10-09-2013 01:12 PM
Change an Insert query into an Update query violentjay25 General 7 02-25-2005 01:05 PM




All times are GMT -8. The time now is 07:52 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World