Question: how sql query can be created for following
I have two table

fist table contain emp code and category like

```
paycode   category
12345     manager
23456     manager
23654     manager
78965     AM
56987     AM
58966     AM

```

and second table contain paycode and leave type taken and date

```
Paycode  leavetype  date
12345      sl      01-01-2017
12345      sl      02-01-2017
12345      sl      03-01-2017
12345      sl      04-01-2017

23456      EL      01-01-2017
23456      EL      01-01-2017
23456      EL      01-01-2017
23456      EL      01-01-2017

```

i want to select a category from first table and against each output i want to count number of a particular leave taken

Answer: 
Will a [`Timer`](https://docs.julialang.org/en/stable/stdlib/base/#Base.Timer-Tuple%7BFunction,Real,Real%7D) work? This form of `Timer` calls your function in a [`Task`](https://docs.julialang.org/en/stable/stdlib/parallel/#Tasks-1) so you need to yield control from you main loop occasionally to allow the timer task to run. You can yield by calling `yield`, `sleep`, `wait`, or doing IO, here I show waiting on the timer.

```
tstart = time()
ncalls = 0
read_modbus() = (global ncalls+=1;@show (time()-tstart)/ncalls,ncalls)
t=Timer((timer)->read_modbus(),0,0.25)

while true
    wait(t) # wait for timer to go off
    println("mainloop $ncalls")
end

```
I noticed that a scheduling library for [Julia](https://julialang.org/) was missing so I wrote one <https://github.com/scls19fr/ExtensibleScheduler.jl>

Here is a basic example using a blocking scheduler.

```
using ExtensibleScheduler

function read_modbus(p1, p2, p3, p4)
    println("Read_modbus with $p1 $p2 $p3 $p4")
end

sched = BlockingScheduler()

add(sched, Action(read_modbus, 1, 1000, 100, 1), Trigger(Dates.Millisecond(250)))

run(sched)

```

Althought, this is a work in progress but contributers are welcome.

Currently (2017-12), there is only an implementation of a blocking scheduler but it should be possible to add multithreading.