February 10, 2018 at 11:28 am
Hey,
If I have a set of records, keep it simple with ID, User and Department:
ID---------User------------Department
1----------Joe Bloggs---Accounts
2----------Jill Bloggs----Engineering
On my web app I group by department, and show each person underneath. I'd like to have a favourites department per user, which is a simple intermediary table:
ID-------Person---------User (this is the current logged in user)
1---------Joe Bloggs---Jill Bloggs
Now the result above for Jill Bloggs should now be.
ID---------User------------Department
1----------Joe Bloggs---Accounts
2----------Jill Bloggs----Engineering
3---------Joe Bloggs----Favourites
The query for this resultset is quite complex so I'd like to avoid a union (and so repetition) if possible, but that is the result I want. Can I do a join to the intermediary table and have it show as an additional row with the fabricated department as 'Favourite'
Thanks
February 12, 2018 at 7:28 am
I've totally binned this idea. I've instead fabricated an additional column which is bit (true if favourite, false if not).
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy