var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Distinct from multiple column(table data)
I have following table structure and data
id | Grade 1 | Grade 2 |Grade 3 |
1 | A | B | C |
2 | B | A | A |
3 | C | B | B |
4 | B | A | D |
I need to know distinct grades which are being used like A,B,C,D
I have tried using sub query, eg first I will get distinct from column 1, then 2 n 3 and union will give Distinct grades.
But I have fear it will degrade sql performance.
I think there can be more optimal way to achieve this.
Could you plz share your view.
If you have indexes on each of grade1, grade2, grade3 performance may be acceptable. Otherwise I would suggest changing your data model to have id and grade only and allow a single id have multiple grades.
Originally Posted by
SELECT grade1 AS grade
Thank you every one for reply..
I have written same query but I was bothered about its performance.
Thanks once again it-iss.com and r937.