Ask a Question related to Coldfusion Database Access, Design and Development.
-
drmaves #1
SQL Query - how to contruct a WHERE clause
I have a field in a table that contains a comma separated list that I want to
be able to determine whether or not any of the items in the list are contained
in another list.
For example:
SELECT *
FROM idx_res
WHERE SelectListingAlert.types IN idx_res.types
Actual data might look like this:
WHERE (RES,HRS,WTR) IN (RES,WTR)
I need to contruct a WHERE clause that takes each item in the first list
(SelectListingAlert.types) and see if it exists in the second list
(idx_res.types). If it exists it should be selected. Each item in the first
list would be treated as OR so if RES or HRS or WTR exists in the second list
it should be selected.
Can someone direct me on what the best way to approach this is?
Thanks.
drmaves Guest
-
Simple WHERE clause in CFQUERY Has error executingdatabase query
Hello, I'm sort of new to CF, but have been doing this enough that this is very frustrating! I'm using the standalone version of ColdFusion 6.1 on... -
Using IN in a WHERE clause
I'm trying to use IN in a WHERE clause as follows: idx_res.city IN ('#session.s_city#') The value of session.s_city is 'highlands ranch, lone... -
CFGRID QUERY USING A WHERE CLAUSE
All of the cfgrid query examples I see do not include a WHERE clause. I would like to know if it is possible to include one and how do you pass in... -
Query Optimizer Problem with Views in where Clause
Hi! I am using Sql 7 SP3. I have noticed strange Query plan when using views. Here is the case: Table1 has Col1, Col2, Col3 .... etc. Col1 is... -
Efficient query without using NOT IN clause
Hi all, I have got two tables:- a) students ======== std_id Numeric std_name Varchar(50) std_grade Varchar(10) -
BKBK #2
Re: SQL Query - how to contruct a WHERE clause
>... takes each item in the first list (SelectListingAlert.types) and see if it
exists inEach item in>... the second list (idx_res.types). If it exists it should be selected.the>... the first list would be treated as OR so if RES or HRS or WTR exists inNo matter what solution you come up with, chances are, it will be different>... second list it should be selected.
>... the best way to approach this is?
for MySQL, MS SQL and Oracle, just to name three. I think the "best way to
approach this" is to do the list calculations in Coldfusion, and then use
the result in the where-clause of your query.
BKBK Guest
-
Dan Bracuk #3
Re: SQL Query - how to contruct a WHERE clause
Create a variable for your where clause. Use list functions on SelectListingAlert.types to build it..
Then use the variable in your query.
Dan Bracuk Guest



Reply With Quote

