Hello,
i have 3 tables:
table1: stables_id | s_title
1 | stable1
2 | stable2
tabl2: animala_id | a_name
1 | Linda
2 | Berta
3 | Siggi
table3: removalsre_id | re_date | re_a_id | re_s_id
1 | 2017-01-10 | 1 | 1
2 | 2017-01-11 | 1 | 2
3 | 2017-01-11 | 2 | 1
4 | 2017-01-12 | 1 | 1
5 | 2017-01-13 | 1 | 2
6 | 2017-01-14 | 3 | 1
now i will check, how many animals were in Stable 1 on 2017-01-12 (answer: 2)
Code:
Query qu = s.createQuery("from Animal as animal where animal IN (select removal.animal from Removal as removal where re_s_id ="+stable.getSId()+")");
//INFO 4 the forum: stable.getSId() returns 1
returns 3, cause I don't know how to realize it with the date
I hope you can help me :-)
Traxxas