posts.*,
$wpdb->term_relationships.term_taxonomy_id,
$wpdb->terms.slug
FROM $wpdb->posts
JOIN $wpdb->term_relationships ON $wpdb->posts.id = $wpdb->term_relationships.object_id
JOIN $wpdb->term_taxonomy ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
WHERE
$wpdb->posts.post_type = ‘wpsc-product’
AND
$wpdb->posts.post_title LIKE ‘%Camera%’
AND
$wpdb->posts.post_content IS NOT NULL
AND
$wpdb->term_taxonomy.taxonomy <> ‘wpsc-variation’
ORDER BY
$wpdb->posts.post_title DESC
“;
$pageposts = $wpdb->get_results($querystr, OBJECT);
if(!$pageposts)
echo $wpdb->last_error;
?>