Skip to content

Instantly share code, notes, and snippets.

@billdozr
Created November 16, 2010 10:06
Show Gist options
  • Save billdozr/701651 to your computer and use it in GitHub Desktop.
Save billdozr/701651 to your computer and use it in GitHub Desktop.
SELECT r.name, b.amount_incl_tax,
(SELECT l.name from labeling_label l INNER JOIN labeling_labeleditem li
ON li.label_id=l.id AND li.object_id=b.id AND li.content_type_id=28 LIMIT 1) AS labels
FROM billing_genericbill b
INNER JOIN billing_recipient r ON b.recipient_id=r.id
ORDER BY labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment