MySQL Forums
Forum List  »  Newbie

Re: SELECT TOP 3 scores in each class with JOIN
Posted by: Daniel Yantis
Date: October 01, 2016 09:29PM

I have much to learn - I don't know how I have gotten this far...

I was under the impression that a full join was similar to a union all.

I read this from 1 tutorial that showed how to achieve full join via union all:
select * from apples as a
left outer join oranges as o on a.price = o.price
union all
select * from apples as a
right outer join oranges as o on a.price = o.price
where a.price is null;

and thus thought they were similar.

Awards.award is type text and not null.
Awards.DSQ is type booleen
HWData.awards = Awards.award

in the program there are specialty awards and best of awards
NOT ALL ENTRIES GET ASSIGNED AN AWARD so HWData.awards can be not set or ""

during the program an award can be assigned to any entry.
however, I was not currently saving Awards.DSQ to HWData
Specialty awards = Awards.DSQ = 0 (False) --- still gets a 1st, 2nd, or 3rd place trophy
Best of awards = Awards.DSQ = 1 (TRUE) --- disqualified for 1st, 2nd, 3rd place trophy

if an entry gets a Best of award they no longer get a trophy
thus, i need to remove Awards.DSQ = 1 (TRUE)from the top 3 results

therefore, I have to get top 3 in each class from HWData but remove Awards.DSQ = 1 from the top 3 selections. I also need to remove unclassed, unscored, and disqualified from top 3 selection but that already works in my current WHERE clause.

I can provide my complete SQL DUMP but I don't see a place to add files here.
The dump contains phone numbers, emails, addresses and such that I don't want public.

PLEASE be patient. I am providing all that I can. If more need just ask.
Thank you for your help - !! for real this is just over my head and i am the only one working on this with NO budget to hire someone. This is a hobby project.

Options: ReplyQuote


Subject
Written By
Posted
Re: SELECT TOP 3 scores in each class with JOIN
October 01, 2016 09:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.