select StatesName.*, if(Seed_Line<>'',Seed_Line,'99') as Bspot, if(Seeding_1_Criteria<>'',Seeding_1_Criteria,99) as Seed, EventName, LPAD(WtClass, 5, ' ') as WTCL ,StatesSchool.SchoolName from StatesName,StatesSchool,StatesEvent WHERE (StatesName.Event_ID=StatesEvent.Event_ID) AND StatesName.School_ID=StatesSchool.School_ID AND (((StatesName.Event_ID=2))) and WtClass='138'AND (StatesName.Misc1 <> '4') ORDER BY Division, WTCL, abs(Bspot), Misc4, Misc1