HubDB code returns string+data for all table rows

Sounds good. Your query doesn’t look right. Should it have an = sign?

{% set query = "membershiptypeid" ~ deals.qualifiedcert %}

{% set query = "membershiptypeid=" ~ deals.qualifiedcert %}

I’d also recommend outputting the query just so you can be sure it looks how you think it looks.