Substituting value via shortcode

If you put variables inside a string, you have to use " double quotes.

So:

// This:
$qstr="
SELECT *
...
ORDER BY $wpdb->posts.post_date DESC
";

// becomes...
$qstr = "
SELECT *
...
ORDER BY $wpdb->posts.post_date DESC
";