Skip to content

Instantly share code, notes, and snippets.

@MisterPhoton
Created February 11, 2011 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MisterPhoton/822715 to your computer and use it in GitHub Desktop.
Save MisterPhoton/822715 to your computer and use it in GitHub Desktop.
SearchQuery
SELECT
a.accountId,
a.name AS accountName,
b.name AS businessName,
b.businessId,
n.employee_id AS teamUserId
FROM
Account AS a
JOIN Business AS b ON a.accountId = b.accountId AND b.deleted = 0
JOIN user_notes AS n ON n.user_id = a.accountId AND n.deleted = 0
WHERE
(b.name LIKE '%business%name%') OR
(a.name LIKE '%business%name%')
ORDER BY
b.name ASC
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment