Subject | Re: [firebird-support] Help me, please take a look at this select! |
---|---|
Author | Lucas Franzen |
Post date | 2004-04-09T09:40:58Z |
Ryan,
sllimr7139 schrieb:
explicite joins.
select
b.lworefid, a.COMPANYNAME, a.CONTACT,
a.ADDRESS, a.CITYPROVINCE, a.POSTALCODE,
a.PHONE, a.FAX, a.CELL,
a.EMAIL, a.memberid
from
industrylwo b
[LEFT] JOIN industrylwoexpressions a ON b.lwoid = a.lwoid
WHERE
B.lwoactive in (0, 1)
/* or: B.lwoactive = 0 OR
B.lwoactive = 1
- but IN should be ressolved to the same */
ORDER BY
b.lwoid, a.companyname
have a look at the plan after preparing the query.
If this doesn't help post the DDL and execution you're getting.
HTH
Luc.
sllimr7139 schrieb:
> I'm pretty sure that what I'm trying to do is not rocket science.You shouldn't do joins in the where clause but replace them with
> This select returns no rows from my database when I think it should.
>
> select
> b.lworefid,
> a.COMPANYNAME,
> a.CONTACT,
> a.ADDRESS,
> a.CITYPROVINCE,
> a.POSTALCODE,
> a.PHONE,
> a.FAX,
> a.CELL,
> a.EMAIL,
> a.memberid
> from
> industrylwoexpressions a,
> industrylwo b
> where
> b.lwoid in (select distinct lwoid from industrylwoexpressions where
> bidawarded in (0)) and
> b.lwoactive in (0, 1)
> order by
> b.lwoid,
> a.companyname
explicite joins.
select
b.lworefid, a.COMPANYNAME, a.CONTACT,
a.ADDRESS, a.CITYPROVINCE, a.POSTALCODE,
a.PHONE, a.FAX, a.CELL,
a.EMAIL, a.memberid
from
industrylwo b
[LEFT] JOIN industrylwoexpressions a ON b.lwoid = a.lwoid
WHERE
B.lwoactive in (0, 1)
/* or: B.lwoactive = 0 OR
B.lwoactive = 1
- but IN should be ressolved to the same */
ORDER BY
b.lwoid, a.companyname
have a look at the plan after preparing the query.
If this doesn't help post the DDL and execution you're getting.
HTH
Luc.