SQLTeam.com | Weblogs | Forums

What is the Work Shift to return


#1

ID Code NameEn StarDate ShiftDayCount
1 1 A 2016-07-31 00:00:00.000 3
3 2 B 2016-07-31 00:00:00.000 3
4 3 C 2016-07-31 00:00:00.000 3

i want Send Date 2016-08-21 what is the Work Shift to return


#2

Please provide:

  • explanation of how "send date" is calculated
  • table description in form of create statement
  • sample data in form of insert statement (make sure sample data shows rows that will and won't show up in you output)
  • your query (what you have written so far to solve your problem)
  • expected output (from the sample data you provide)

#3

i want Send parameter @DateNw = '08/08/2016'
Result
ID Code NameEn StartDate ShiftDayCount
4 3 C 2016-07-31 00:00:00.000 3


#4

From the sample you gave us, why would row with id=4 qualify?


#5

Depending on ShiftDayCount


#6

Lets say your sample data is:

ID  Code  NameEn  StarDate                 ShiftDayCount
1      1  A       2016-07-31 00:00:00.000              3
3      2  B       2016-07-31 00:00:00.000              3
4      3  C       2016-07-31 00:00:00.000              3
5      4  D       2016-08-01 00:00:00.000              3
6      5  E       2016-08-02 00:00:00.000              3
7      6  F       2016-08-03 00:00:00.000              3
8      7  G       2016-08-04 00:00:00.000              3
9      8  H       2016-08-05 00:00:00.000              3
10     9  I       2016-08-06 00:00:00.000              3

and you want send date 2016-08-05, which row(s) would qualify?