0

SQL query for this scenario

How would you write the query for this situation? https://code.sololearn.com/WqSU5jHlcJ9V/?ref=app

24th Aug 2019, 3:10 AM
Fernando Moceces
Fernando Moceces - avatar
1 ответ
0
I didn't test this but it would be something like: SELECT a.Id as Id, a.Name as Name, COUNT(b.AchievementId ) as Achievements FROM Fox a, FoxAchievement b WHERE a.Id = b.Id AND a.Gender = 'female' AND b.AcquireDate <= 20190330; Note: "b.AcquireDate <= 20190330" <- depends on the format the date field is held in. Most likely UNIX timestamp format so you would need to use a function to convert the value to human readable format, and to whatever appropriate date format you are using.
13th Oct 2019, 11:26 PM
Nathan Stanley
Nathan Stanley - avatar