[wellylug] sql query so slooooooow
John Fouhy
john at fouhy.net
Tue Nov 20 11:17:39 NZDT 2007
On 20/11/2007, E Chalaron <e.chalaron at xtra.co.nz> wrote:
> Hi there
> I am trying a MysQl query, which seems to me relatively easy.
> I am trying that with command lines so far.
> So login to Mysql, select database and
>
> SELECT `task`.`name`, `project`.`name`, `task`.`date_closed` FROM task,
> project ORDER BY `task`.`name` ASC, `project`.`name` ASC,
> `task`.`date_closed` ASC;
You're selecting here every row from a "full outer join" of 'task' and
'project'. This is a cartesian product of the two sets, if you're not
familiar with SQL jargon. The result will have |task|*|project| rows,
which could be a big number :-)
If this is not what you want, you need to figure out how you want to
join your tables together. You may want an inner join or a left
join...
--
John.
More information about the wellylug
mailing list