本文介绍了使用具有一些硬编码值的两个表的值在SQL中创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用带有一些硬编码值的两个表的值在SQL中创建一个表。

i想为每个employee_code插入punchin和puchout,我将从[AttendanceCorrection]中获取。[dbo]。[来自[Zultime]的Tbl_FMOEmp]和Punch_Date。[dbo]。[TIME_SHEET]



我尝试了什么:



INSERT INTO Tbl_EmpNotPunching

选择

(SELECT [employee_Code] FROM [AttendanceCorrection]。[dbo]。[Tbl_FMOEmp])as employee_Code ,

(选择不同[Punch_Date] FROM [Zultime]。[dbo]。[TIME_SHEET])作为Punch_Date,

'7:30'作为PunchIN,

'16:30'作为打击

creating a table in SQL using values of two table with some hard coded values.
i want to insert punchin and puchout for each employee_code which i will get from [AttendanceCorrection].[dbo].[Tbl_FMOEmp] and Punch_Date from [Zultime].[dbo].[TIME_SHEET]

What I have tried:

INSERT INTO Tbl_EmpNotPunching
select
(SELECT [employee_Code] FROM [AttendanceCorrection].[dbo].[Tbl_FMOEmp]) as employee_Code,
(SELECT distinct [Punch_Date] FROM [Zultime].[dbo].[TIME_SHEET]) as Punch_Date,
'7:30' as PunchIN,
'16:30' as punchOUT

推荐答案


这篇关于使用具有一些硬编码值的两个表的值在SQL中创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 07:45
查看更多