Hi all


I need some help with a query that supplies a report.


The issue for me is one of the tables: (simplified)


Table
UID   Name     Description  Parent  Project_id

This table contains different information in the same field (name),like the
projects status (Initializing, Engineering, etc) , the type of project
(Contractor, Govt), and condition (Open, Closed).


So projects can have 1, 2 or 3 records in this table.


The problem is if the user wants a report of all Open-Engineering-Govt
projects.


Name is a Text field.


So I can get all the open with:


WHERE name LIKE '%Open%'
(needs to be LIKE because the information is not consistant, ie:  Open, is
Open,  Opened, etc).


But


WHERE name LIKE '%Open%' and name LIKE '%Engineering%'
gets me nothing becuase the field cant be both at same time


and
WHERE name LIKE '%Open%'  or name LIKE '%Engineering%'
gets me projects that are closed as well as open


I can get the information I need by running mulitple queries:


<CFQUERY name="first">
    WHERE name LIKE '%Open%'
</CFQUERY>


<CFOUTPUT query="first">
        <CFQUERY name="second">
            WHERE name LIKE '%Engineering%' and project_ID =
#first.project_id#
        </CFQUERY>
    <CFIF second.recordcount GT 0>
        is both opened and Engineering.
    </CFIF>
</CFOUTPUT>


But this is cumbersome.


anyone know a better way?


We are using:  CF5 and SQL 2000.


Thanks
Rodney
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to