Hi, I have the following problem for a medical research question. Imagine having a list of people and you ask them 2 quesions - do you smoke? do you have diabetes? etc etc. In sql I have made a series of left joins so that a table has been made where if they have answered yes to a question, the word " SMOKER " comes up in the column field smoker. And the same for any other positive values. I want to update the word "SMOKER" to "YES" as smoker is already the column header.I have this: Smoker Diabetes---------------------------------------------------------Person1 smokerPerson2 diabetesbut what I want is this: Smoker Diabetes---------------------------------------------------------Person1 Yes Person2 YesMy code is:SELECT DISTINCT Person, question.s AS Smoker, q.d AS Diabetic from(SELECT DISTINCT Person, questionFROM databaseWHERE answer = 'smoker') ALEFT JOIN(SELECT DISTINCT Person, questionFROM databaseWHERE answer = 'diabetes') BON A.Person = B.Person
Thanks in advance!