There exists a table called Species which includes Sp_name, Sp_woodtype, Sp_maxht (species' max height) and I am asked this question:
For each species with the same woodtype (sp_woodtype) compare their max height. The output should include the species wood type, species name of the larger height and the species name of the smaller height.
How should this be done?
Edit 1: I have tried:
SELECT sp_woodtype, sp_name a AS Larger, sp_name b AS Smaller
FROM Species
WHERE a.sp_woodtype = b.sp_woodtpye AND a.sp_maxht>b.sp_maxht;