I'd like some help with whether there is an easier way to achieve the stated aim without lots of sub-selects.
sql looks like this (simplified)
I am looking to produce a query that outputs this
I think I have been able to obtain this report via multiple subselects but the query time is in excess of 7 seconds where the route table has only 3k records, the validation 12k and the user table 2k records.
Am I missing an easy fix here?
thanks
Justin
sql looks like this (simplified)
Code:
create table users (userID int(11), country int(11), name varchar(255));
create table countries (countryID int(11), countryName varchar(255));
create table validations (id int(11), route_id int(11));
create table routes (route_id int(11), user_id int(11), status enum('draft','filed','rejected'), dateFiled datetime);
create table logins (eventID int(11), user_id int(11), loginTime datetime);
I am looking to produce a query that outputs this
Code:
name,
last logged in,
country name,
number of routes that have the status 'filed'
last date on which a route was filed with the status either filed or rejected,
total number of validations for the user
I think I have been able to obtain this report via multiple subselects but the query time is in excess of 7 seconds where the route table has only 3k records, the validation 12k and the user table 2k records.
Am I missing an easy fix here?
thanks
Justin