WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 482 reviews for our classroom and online training

Details for FelixP

FelixP has participated in the following threads:

Added by FelixP on 21 Mar 2021 at 10:51

MYSQL solution

For mysql-typical error 1235 see this https://stackoverflow.com/questions/17892762/mysql-this-version-of-mysql-doesnt-yet-support-limit-in-all-any-some-subqu

SELECT EventName , EventDetails
    FROM tblEvent e1
    WHERE e1.CountryID NOT IN
    (  SELECT sub1.CountryID FROM -- wrapping due due Error code: 1235
       (SELECT c1.CountryID FROM tblCountry c1 
      ORDER BY c1.CountryName DESC
       LIMIT 30) sub1
 AND e1.CategoryID NOT IN
        SELECT sub2.CategoryID FROM   -- wrapping due due Error code: 1235
        (SELECT cat1.CategoryID FROM tblCategory cat1
         ORDER BY cat1.CategoryName DESC
        LIMIT 15) sub2
    ORDER BY e1.EventDate

Added by FelixP on 21 Mar 2021 at 11:24

MYSQL solution:

select sub1.ContName as Continent, eventName as Event from tblEvent e
    join tblCountry ctr on ctr.CountryID = e.CountryID
    join (
        select cont1.ContinentID, cont1.ContinentName as ContName, count(e1.EventID) as eventCount 
        from tblEvent e1
            join tblCountry ctr1 on ctr1.CountryID = e1.CountryID
            join tblContinent cont1 on cont1.ContinentID = ctr1.ContinentID
            group by cont1.ContinentID, cont1.ContinentName
            order by eventCount 
            limit 3) as sub1
        on sub1.ContinentID = ctr.ContinentID

Added by FelixP on 22 Mar 2021 at 21:19

You won't  spoil it TOTOally, huh? D