Insert Query (1 Viewer)

Arvive

Registered User
Joined
Aug 14, 2019
Messages
13
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.
 

MajP

Surrender Dorothy!" That's all!
Joined
May 21, 2018
Messages
2,420
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom