Subject | Re: does firebird always go fastest way? |
---|---|
Author | martinknappe |
Post date | 2006-05-17T13:58:31Z |
ahh, now ic!!!
even though this very query was still not it, i was able to deduce
from it and martijns short example how it should be done
one before where i didn't use joins):
select d.*
from dicentries d
inner join dskrptlink_dicentries link1
on link1.id_dicentry = d.id
inner join dskrptlink_dicentries link2
on link2.id_dicentry = d.id
inner join dskrptlink_dicentries link3
on link3.id_dicentry = d.id
inner join dskrpts d1
on d1.id = link1.id_dskrpt
inner join dskrpts d2
on d2.id = link2.id_dskrpt
inner join dskrpts d3
on d3.id = link3.id_dskrpt
where (d1.asdskrpt = 'abc') and (d2.asdskrpt = 'def') and (d3.asdskrpt
= 'ghi')
thanx for that guys
even though this very query was still not it, i was able to deduce
from it and martijns short example how it should be done
> select d.id, d.whateverfieldsyouwanttooutputnow, my query looks like this and (and it works ALOT faster than the
> from dicentries d
> inner join dskrptlink_dicentries link
> on link.id_dicentry = d.id
> inner join dskrpts
> on dskrpts.id = link.id_dskrpt
> where dskrpts.asdskrpt in ('abc', 'def', 'ghi')
> group by d.id, d.whateverfieldsyouwanttooutput
> having count(*) >= 3
one before where i didn't use joins):
select d.*
from dicentries d
inner join dskrptlink_dicentries link1
on link1.id_dicentry = d.id
inner join dskrptlink_dicentries link2
on link2.id_dicentry = d.id
inner join dskrptlink_dicentries link3
on link3.id_dicentry = d.id
inner join dskrpts d1
on d1.id = link1.id_dskrpt
inner join dskrpts d2
on d2.id = link2.id_dskrpt
inner join dskrpts d3
on d3.id = link3.id_dskrpt
where (d1.asdskrpt = 'abc') and (d2.asdskrpt = 'def') and (d3.asdskrpt
= 'ghi')
thanx for that guys