Skip to content

Instantly share code, notes, and snippets.

@mrjman
Last active August 29, 2015 14:06
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 mrjman/22a27208b89b2ef2bc7e to your computer and use it in GitHub Desktop.
Save mrjman/22a27208b89b2ef2bc7e to your computer and use it in GitHub Desktop.
SELECT motor_symptoms.description, profiles_motor_symptoms.id FROM motor_symptoms LEFT OUTER JOIN profiles_motor_symptoms ON motor_symptoms.id=profiles_motor_symptoms.motor_symptom_id WHERE profiles_motor_symptoms.profile_id=11;
SELECT description, profiles_motor_symptoms.id FROM motor_symptoms LEFT OUTER JOIN profiles_motor_symptoms ON profiles_motor_symptoms.motor_symptom_id=motor_symptoms.id;
@zznq
Copy link

zznq commented Sep 12, 2014

SELECT ms.description, pms.id
FROM motor_symptoms ms LEFT OUTER JOIN 
            profiles_motor_symptoms pms ON ms.id=pms.motor_symptom_id
WHERE (pms.profile_id=11 or pms.profile_id is NULL);

@mrjman
Copy link
Author

mrjman commented Sep 12, 2014

SELECT description, p.id from motor_symptoms as m LEFT JOIN profiles_motor_symptoms as p on m.id=p.motor_symptom_id;

          description          | id 
-------------------------------+----
 Resting Tremor                |  3
 Slowness                      |  4
 Resting Tremor                |  5
 Slowness                      |  6
 Small Handwriting             |  7
 Resting Tremor                |  8
 Trouble walking/Shuffled Gait |  9
 Slowness                      | 10
 Resting Tremor                | 11
 Slowness                      | 12
 Small Handwriting             | 13
 Resting Tremor                | 14
 Trouble walking/Shuffled Gait | 15
 Trouble walking/Shuffled Gait | 22
 Slowness                      | 23
 Small Handwriting             | 24
 Resting Tremor                | 25
 Falling, poor balance         | 26
 Slowness                      | 27
 Small Handwriting             | 28
 Resting Tremor                | 29
 Small Handwriting             | 30
 Slowness                      | 31
 Resting Tremor                | 32
 Resting Tremor                | 33
 Trouble walking/Shuffled Gait | 34
 Slowness                      | 35
 Small Handwriting             | 36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment