如果选择日历和日期,如何将数据插入mysql数据库单独的行? [英] How to insert data into mysql database separate row if calendar from and till date are selected means?

查看:126
本文介绍了如果选择日历和日期,如何将数据插入mysql数据库单独的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有员工ID 123456等数据,他将于2017年11月26日至2017年2月12日期间休假。



i am拥有带有EmployeeId LeaveDates的MySQL数据库字段名称

所以我应该以下面的格式插入数据,例如

EmployeeId LeaveDates

123456 26- 11-2017

123456 27-11-2017









123456 2-12-2017赞。任何人都可以就上述问题向我提出建议..



我的尝试:



我可以保存数据

employeeId FromDate Tilldate

123456 26-112017 2-12-2017

但是我想要单独的行......

解决方案

你可以使用多个插页 [ ^ ] <上一页lang =SQL> INSERT tableName(EmployeeId,LeaveDates) VALUES
123456 ' 2017-11-26'),
123456 ' 2017-11- 27'),
...
123456 ' 2017-12-01'),
123456 ' 2017-11-02'


i am having the data like Employee ID 123456 he is going on leave from the date of 26-11-2017 till 2-12-2017 .

i am have the MySQL database field names with EmployeeId LeaveDates
so i should get the data inserted in the below format like
EmployeeId LeaveDates
123456 26-11-2017
123456 27-11-2017
.
.
.
.
123456 2-12-2017 like this. can any one suggest me on above question..

What I have tried:

I am able to save the data with
employeeId FromDate Tilldate
123456 26-112017 2-12-2017
but i want separate row wise......

解决方案

You can use multiple inserts[^]

INSERT tableName (EmployeeId,LeaveDates) VALUES 
(123456, '2017-11-26'),
(123456, '2017-11-27'),
...
(123456, '2017-12-01'),
(123456, '2017-11-02')


这篇关于如果选择日历和日期,如何将数据插入mysql数据库单独的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆