Skip to content

Instantly share code, notes, and snippets.

@monokrome
Created September 26, 2011 07:21
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 monokrome/1241776 to your computer and use it in GitHub Desktop.
Save monokrome/1241776 to your computer and use it in GitHub Desktop.
# PHP (theory, really - this is hundreds of lines of refacatoring)
jempe_users
user_id
blah
blha
blah
jempe_employees
user_id
blah
blah
blah
jempe_shoppers
user_id
blah
blah
blah
Jeff Bloo`m - Shopper, user_id = 6
SELECT
u.user_id
FROM
jempe_users AS u
INNER JOIN
jempe_employees
AS e
ON e.user_id = u.user_id
INNER JOIN
jempe_shoppers
AS s
ON s.user_id = u.user_id
# Django (Same pattern, real code)
from django.contrib.auth.models import User
class Employee(User):
employee_level = models.PositiveIntegerField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment