Whether you're permy or contracting, it seems to me that the three KPIs affecting happiness at work are money, people, and the actual work you're doing.
All three and you're onto a winner. Don't tell a soul, they will want your job.
Two - probably most of us - and you're happy enough but open (vulnerable?) to better offers.
Only one and you're probably not going to stick around.
It's not as simple as this though, the job climate has a profound effect on how we perceive our jobs. If work is thin on the ground I'll do practically anything as long as it's legal, doesn't hurt and doesn't smell.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden