selection based upon time differances.

selection based upon time differances.

Post by johann » Sat, 23 Aug 2003 17:19:41



Hi There

I am a relative newbie to the more complex SQL statements flying
around my head currently. First off I would like to sketch the
scenario and then in Structured english layout what I want to do. any
hints, tips, suggestions will be greatly appreciated.

The company I work for logs all entries and departures from our
building each day. From his welter of information we would like to
exract the first login and last logout for the day. The problem is
that all smokers use their access cards to go outside to smoke, and
reps go and c clients. furthermore on the floor (we are a printing
company) we have shifts, and at anypoint a shift can span 2 days (thus
the query cannot only b focussed on 2day). somebody can also work
overtime (and even work for 2 days non stop) and we need to be certain
it did happen else they won't get their overtime pay!!!

currently the query we use basically gets the first login and the last
logout but accross 2days (thus making it xtremely inaccurate).

in structred english what i need to do is the following:
Select the firstlogin of a specified date and the last logout
(following this first login) where the datediff is greater than 4 hr
before the next login on the system.

Hope this makes some sense.
:D:D:D
johannes

 
 
 

selection based upon time differances.

Post by Jens Sü?meye » Sat, 23 Aug 2003 17:38:07


If you have already a database send the DDL and some examples, should be
easier to help you.

If you want to solve the problem on your own, just try to use a case stement
and figur out, if the employee did a shift spanning two days or only one
day. (you can also use a subquery, depends on your design)

HTH, Jens S?meyer.



Quote:> Hi There

> I am a relative newbie to the more complex SQL statements flying
> around my head currently. First off I would like to sketch the
> scenario and then in Structured english layout what I want to do. any
> hints, tips, suggestions will be greatly appreciated.

> The company I work for logs all entries and departures from our
> building each day. From his welter of information we would like to
> exract the first login and last logout for the day. The problem is
> that all smokers use their access cards to go outside to smoke, and
> reps go and c clients. furthermore on the floor (we are a printing
> company) we have shifts, and at anypoint a shift can span 2 days (thus
> the query cannot only b focussed on 2day). somebody can also work
> overtime (and even work for 2 days non stop) and we need to be certain
> it did happen else they won't get their overtime pay!!!

> currently the query we use basically gets the first login and the last
> logout but accross 2days (thus making it xtremely inaccurate).

> in structred english what i need to do is the following:
> Select the firstlogin of a specified date and the last logout
> (following this first login) where the datediff is greater than 4 hr
> before the next login on the system.

> Hope this makes some sense.
> :D:D:D
> johannes


 
 
 

1. Can I create a backup filename base upon the date time

Can I create a differential or a full or a transaction log backup job that
generates the backup file with the name of the file based upon time.

for example  mydatabase-differential-20030415500554.bak

I am thinking that I can use a time variable in the file name to get the
time portion of my file name like....
mydatabase%date%%time%.bak

thanks
-Tom

2. View Primary Keys

3. backup filename based upon time?

4. Check constraints

5. Need help triggering script upon value list selection

6. VAJava OS/2 -> ODBC/DB2

7. cancel based, change based and time based recovery

8. ldf file deleted- db won't work

9. Automatically adding records based upon data in another table

10. duplicate data based upon primary key

11. Sending Mail to people based upon results from Query

12. Newbie questions about workflow based upon response from user, restarting the package

13. splitting field based upon values