By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
select distinct (tb1.SupporterID), tb1.lotteryNumber, tb1.DrawNumber, tb1.PrizeDrawID, tb1.prizeValue, tb1.winningTicket, tb1.title, tb1.initials, tb1.surname, tb1.address1,tb1.address2,tb1.address3,tb1.address4, tb1.supporterNumber, tb1.prizeName from ( select distinct pw1.SupporterID, pw1.PrizeWinID, Lpt.lotteryNumber, pw1.DrawNumber, pw1.PrizeDrawID, pd.prizeValue, pw1.winningTicket, pw1.title, pw1.initials, pw1.surname, pw1.address1,pw1.address2,pw1.address3,pw1.address4, s.supporterNumber, p.prizeName from prize_win pw1 inner join ( select pt.purchasedTicketID,L.lotteryNumber from purchased_Ticket pt inner join lottery L on pt.lotteryID = L.lotteryID where L.lotteryNumber between 215 and 230) Lpt on pw1.PurchasedTicketID = Lpt.purchasedTicketID inner join prize_draw pd on pw1.PrizeDrawID = pd.PrizeDrawID inner join supporter s on pw1.SupporterID = s.SupporterID inner join prize p on pw1.PrizeDrawID = p.PrizeDrawID) tb1 inner join (select pw1.SupporterID, pw1.PrizeWinID from prize_win pw1 inner join ( select pt.purchasedTicketID from purchased_Ticket pt inner join lottery L on pt.lotteryID = L.lotteryID where L.lotteryNumber between 215 and 230) Lpt on pw1.PurchasedTicketID = Lpt.purchasedTicketID ) tb2 on tb1.SupporterID = tb2.SupporterID where tb1.PrizeWinID <> tb2.PrizeWinID order by tb1.SupporterID asc;
Dig Deeper on Oracle and SQL
Related Q&A from Mike Ault
I am trying to remove carriage returns at the end of clob fields in SQL*Plus. This just nulls out the field in the table. What do I need to change to...continue reading
How to find the definition or structure of a dropped table? I know the table's name but I don't know the columns and datatypes. It no longer exists.continue reading
We're using the following string to connect to the Oracle DB Server through the OraOLEDB Driver. We want to read WSID from this string in the ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.