Well, if I understand correctly, you're gathering results from one query, then slightly modifying the query and getting other results (more current ones, maybe?).
To me it looks like your second query is simply malformed. Say, this is your first one:
SELECT * FROM jobs where 1 and (division='A' or division='B') and (sector='AD') and (location='DC') order by division
Then you're using .="and upload_date > $last_sent" to append to it.
But, that would result in:
SELECT * FROM jobs where 1 and (division='A' or division='B') and (sector='AD') and (location='DC') order by divisionand upload_date > $last_sent
And that clearly just isn't a well-formed query. So, I would suggest adding some code to separate the query by " order ". Then you'll have two strings...
SELECT * FROM jobs where 1 and (division='A' or division='B') and (sector='AD') and (location='DC')
AND
by division
After that, append and upload_date > $last_sent to the first one, but make sure you include a space!
Like this:
$first_str .=" and upload_date > $last_sent";
Then make your final string by doing this:
$final_str = $first_str . " order " . $second_str;
Not that I ever test most things like this before posting, but that's how I'd do it. If I'm answering the wrong question or you need further help, just post again. But, I hope that made some sense and helped you out. 🙂
[QUICK EDIT]
By the way, if I was on the right track, but you need some help modifying the code, let me know and I'll do it for you along with providing a short explanation.
[/QUICK EDIT]
[ANOTHER QUICK EDIT]
If I did that right, the final query I was trying to form was:
SELECT * FROM jobs where 1 and (division='A' or division='B') and (sector='AD') and (location='DC') and upload_date > $last_sent order by division
Just thought that might clear up what I was doing.
[/ANOTHER QUICK EDIT]