Created
September 26, 2011 07:21
-
-
Save monokrome/1241776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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