I would check the output of $querystr
. It looks like you have the table name twice. $wpdb->postmeta
resolves to something like wp_postmeta
and then you have postmeta
again. This gives you wp_postmetapostmeta
which isn’t a valid table.
I highly recommend you try out Debug Bar. It greatly simplifies query debugging.