Subject | RE: [IBO] SQLWhere Items ??? |
---|---|
Author | Alan McDonald |
Post date | 2003-04-27T02:42:08Z |
>This is the statement it's trying to prepare:
> Alan,
> Could you please paste exactly what you see in the SQL Monitor?
>
> Helen
>
SELECT ID, F_PADLEFT(LINKTOMEMBER,'0',6) LINKTOMEMBER, JOBTITLE,
SHORTDESCRIPTION, SUBMITDATE, EMPTIME, EMPSTATUS, ADREF,
(SELECT TITLE FROM LOCATION WHERE ADVERTISEMENTS.LINKTOLOCATION=LOCATION.ID)
AS LOCATION,
(SELECT TITLE FROM ROLECATEGORIES WHERE
ADVERTISEMENTS.LINKTOROLECATEGORY=ROLECATEGORIES.ID) AS CATROLE,
(SELECT ADTEMPLATE FROM MEMBERS WHERE
ADVERTISEMENTS.LINKTOMEMBER=MEMBERS.MEMNO) AS ADTEMPLATE,
(SELECT USECUSTOM FROM MEMBERS WHERE
ADVERTISEMENTS.LINKTOMEMBER=MEMBERS.MEMNO) AS USECUSTOM,
f_dayofmonth(SUBMITDATE)||'.'||f_month(SUBMITDATE)||'.'||f_year(SUBMITDATE)
MYSUBMITDATE
FROM ADVERTISEMENTS
SUBMITDATE DESC
WHERE (ADVERTISEMENTS.ADACTIVE = -1)
AND (ADVERTISEMENTS.EXPIRY > 'NOW')
from this code:
procedure TForm1.IB_CAdvertsPrepareSQL(Sender: TIB_Statement);
begin
IB_CAdverts.SQLWhereItems.Add('(ADVERTISEMENTS.ADACTIVE = -1) ');
IB_CAdverts.SQLWhereItems.Add('(ADVERTISEMENTS.EXPIRY > ''NOW'') ');
if (Pos('0',IB_CMembers.FieldByName('JSLOCATION').AsString)=0) then
IB_CAdverts.SQLWhereItems.Add('LINKTOLOCATION IN
('+IB_CMembers.FieldByName('JSLOCATION').AsString+')');
if (Pos('0',IB_CMembers.FieldByName('JSEMPROLE').AsString)=0) then
IB_CAdverts.SQLWhereItems.Add('LINKTOROLECATEGORY IN
('+IB_CMembers.FieldByName('JSEMPROLE').AsString+')');
if (IB_CMembers.FieldByName('JSEMPTIME').AsString<>'either') then
IB_CAdverts.SQLWhereItems.Add('EMPTIME =
'''+IB_CMembers.FieldByName('JSEMPTIME').AsString+'''');
if (IB_CMembers.FieldByName('JSEMPSTATUS').AsString<>'either') then
IB_CAdverts.SQLWhereItems.Add('EMPSTATUS =
'''+IB_CMembers.FieldByName('JSEMPSTATUS').AsString+'''');
IB_CAdverts.SQLOrder.Add('SUBMITDATE DESC');
end;
And thanks for the explanation on the sequence for WhereItems
Alan