On 6/1/2016 5:36 PM, Russell, Rory wrote:
In SQLIte, I have 2 tables, one is for a list of Projects (about 50
projects) and the other is a list of key dates for each project. Each
project has about 20 key dates.
How can run a query that will only return the top/first 5 dates for each
project in one query.
Something along these lines, perhaps:
select ProjectName, KeyDate
from Projects p, KeyDates using (ProjectID)
where KeyDate in (
select d2.KeyDate from KeyDates d2
where d2.ProjectId = p.ProjectId
order by d2.KeyDate limit 5);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users