Insert Query (1 Viewer)

Arvive

Registered User.
Local time
Today, 19:28
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

You've got your good things, and you've got mine.
Local time
Today, 15:28
Joined
May 21, 2018
Messages
8,463
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

Top Bottom