Question
CFM and DB SubSelect SQL?
Hello all,
Thanks for any help you can give..... but I'm working on creating an SQL search statement of an Access Database.... (Using CFM 7).
Now, I have two(2) criteria that must to be met in the SQL statement ...listed at the beginning of the SQL statement below.... but then in additon to that........ I have 4 criteria which should be retrieved if any of the 4 statements are true... (So, basically OR statements..) I've read something about Sub Selects?.... Is this type of thing something I should use...or am I going about this incorrectly? SQL commented below.
Thanks for any help you can give :)
-------------------------------------------------------------------------------------------------------------
<cfquery name="dateInfo" datasource="CaProjectNew">
SELECT * FROM CAprojectDB, mailOrder
<!-- these two need to be true -->
WHERE ((CAprojectDB.ProjectID = mailOrder.ProjectID) AND mailOrder.DMCRepID = '#searchbyfieldDMC#'
<!-- and where any one of these statements are true - OR Clauses?-->
<!-- do I use some kind of Sub Select here? -->
(#dropdate# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate2# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate3# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate4# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
<!-- optional Order Clause -->
ORDER BY mailOrder.dateAdded DESC
</cfquery>
-------------------------------------------------------------------
Tim
Thanks for any help you can give..... but I'm working on creating an SQL search statement of an Access Database.... (Using CFM 7).
Now, I have two(2) criteria that must to be met in the SQL statement ...listed at the beginning of the SQL statement below.... but then in additon to that........ I have 4 criteria which should be retrieved if any of the 4 statements are true... (So, basically OR statements..) I've read something about Sub Selects?.... Is this type of thing something I should use...or am I going about this incorrectly? SQL commented below.
Thanks for any help you can give :)
-------------------------------------------------------------------------------------------------------------
<cfquery name="dateInfo" datasource="CaProjectNew">
SELECT * FROM CAprojectDB, mailOrder
<!-- these two need to be true -->
WHERE ((CAprojectDB.ProjectID = mailOrder.ProjectID) AND mailOrder.DMCRepID = '#searchbyfieldDMC#'
<!-- and where any one of these statements are true - OR Clauses?-->
<!-- do I use some kind of Sub Select here? -->
(#dropdate# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate2# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate3# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
OR (#splitdate4# BETWEEN #CreateODBCDate(form.startDate)# AND #CreateODBCDate(form.endDate)#))
<!-- optional Order Clause -->
ORDER BY mailOrder.dateAdded DESC
</cfquery>
-------------------------------------------------------------------
Tim
