fixed subquery

Signed-off-by: Tim Traver <ttraver@mivamerchant.com>