Suppose I have two tables Doctor
& Doctor_department
In Doctor_department
table have some departments
department list
a(priority=1), b(priority=2), c(priority=3)
And In Doctor
table there also have some doctor list with priority under those departments
doctor list
d1(prority=1, dpearmtent=a), d2(prority=2, dpearmtent=a), d3(prority=3, dpearmtent=a), d4(prority=4, dpearmtent=b), d5(prority=5, dpearmtent=b), d6(prority=6, dpearmtent=c), d7(prority=7, dpearmtent=c)
Now I want to query those doctors according to department and priority like below format
(a(d1,d2,d3)),(b(d4,d5)),(c(d6,d7))
What is the query for MySQL?
I can fetch doctors list ascending order according to their priority but can't fetch doctor with department in ascending order according to its priority.
Query
Doctor_list = Doctor::orderBy('priority', 'ASC')->get();
Anybody can help please ? Thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire