gvamsimba
asked on
TSQL Query
HI, Below is my sample data from a table. I just want
to get those id's where the answer to qid 82 is greater
than the answer given to qid 1306.
Can any one give me that TSQL script please ?
Thanks
id QID Answer Startdate
1 1306 2018 31/03/2009
1 82 3099 30/09/2007
select A.*
from Table1 A
inner join table1 B on B.ID = A.ID
where A.QID = 82
and B.QID = 1306
and A.Answer > B.Answer
SELECT id FROM TABLE
WHERE qid > 82 AND qid = 1306
WHERE qid > 82 AND qid = 1306
Hi,
Please try following:
select a.id, a.QID, a.Answer, a.Startdate
From Table a
Inner Join Table on a.Answer>b.Answer
Where a.Answer = 82
Thanks
Please try following:
select a.id, a.QID, a.Answer, a.Startdate
From Table a
Inner Join Table on a.Answer>b.Answer
Where a.Answer = 82
Thanks
I don't think your statement of the problem makes sense.....and as a result, I don't think the solutions do either.
arabhai : will always return the id from qid = 1306
ewangoya: will always return the row with qid = 83 unless the values for answer are changed in which case it may return nothing - these are the only two possibilities
Can I respectfully suggest you check your statement of the requirements?
arabhai : will always return the id from qid = 1306
ewangoya: will always return the row with qid = 83 unless the values for answer are changed in which case it may return nothing - these are the only two possibilities
Can I respectfully suggest you check your statement of the requirements?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WHERE id > 82 AND id = 1306