使用 MYSQL 从结果中获取报告 [英] Get report from a the result using MYSQL

查看:47
本文介绍了使用 MYSQL 从结果中获取报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从桌子上休息一周.表中有一个字段 tblweekoff

fldid flddept fldemployee fldintime fldouttime fldlateafter fldearlybefore fldweekoff fldshiftname fldassigndate fldfromdate fldtodate fldrefid1 Corporate 00625267-Karthick S 09:30 am 06:15 pm 09:30 am 06:15 pm 周六、周日、COR-General Shift 07-25-2012 07-01-2012 07-31-2012

我想得到这样的报告.

fldemployee flddate fldweekoff00625267-Karthick S 07-25-201200625267-Karthick S 07-27-201200625267-Karthick S 07-28-2012 周休00625267-Karthick S 07-29-2012 周休00625267-Karthick S 07-30-201200625267-Karthick S 07-31-201200625267-Karthick S 08-01-2012 周休00625267-Karthick S 08-02-2012 周休00625267-Karthick S 08-03-201200625267-Karthick S 08-04-2012......

我想要从 07-25-2012 到 08-10-2012 的报告意味着上面的结果显示是这样的..

请帮我做这件事..

解决方案

您首先要创建一个日历表.

参见 Mysql:选择两个日期之间的所有数据>

从那里您可以将日历表中的结果加入到员工中.

I want to get the week off from a table. The table having a field tblweekoff the

fldid   flddept     fldemployee         fldintime   fldouttime  fldlateafter    fldearlybefore  fldweekoff  fldshiftname    fldassigndate   fldfromdate fldtodate   fldrefid
1       Corporate   00625267-Karthick S 09:30 am    06:15 pm    09:30 am        06:15 pm         Sat,Sun,   COR-General Shift 07-25-2012    07-01-2012  07-31-2012

I want to get the report like this.

fldemployee           flddate       fldweekoff 
00625267-Karthick S   07-25-2012    
00625267-Karthick S   07-27-2012    
00625267-Karthick S   07-28-2012    weekoff
00625267-Karthick S   07-29-2012    weekoff
00625267-Karthick S   07-30-2012    
00625267-Karthick S   07-31-2012    
00625267-Karthick S   08-01-2012    weekoff
00625267-Karthick S   08-02-2012    weekoff
00625267-Karthick S   08-03-2012    
00625267-Karthick S   08-04-2012   
......

I want to get the report from 07-25-2012 to 08-10-2012 means the above result display like that..

Please help me to do this..

解决方案

You will first want to create a calendar table.

See Mysql: Select all data between two dates

From there you can join the results from the calendar table to the employees.

这篇关于使用 MYSQL 从结果中获取报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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