Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 AND/OR assistance

Author  Topic 

babray
Starting Member

16 Posts

Posted - 2005-06-02 : 14:39:19
Hi!
Back again to the SQL EXPERTS!!! This time I think far above my head! I read the posting of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50533 and the situation may be similar, I'm not sure.
Here's the situation, and it is two parted.

Here's the query:
<cfquery name="listall" datasource="mmdb">
select distinct m.met_id,m.metname
from MineralDesc m,
M_Keyword k
where m.met_id = k.met_id
and k.key_id in ( 0#form.keywords# )
order by metName asc
</cfquery>

I have a ColdFusion page that is sending a CSV that I want to do an AND search on. Currently it works fine (as usual) for the OR search. It looks like from the previous post that the Having Count (*) = # works but I cannot get it working. I have tried using a cfset to set a counter, and adding the Having clause to no avail. I am definitely missing something.

Secondly, I really need to pass an additional value, in this case another key_id value to add to the query. I have tried adding "and k.key_id = ### to no avail. More AND query woes!

ANY help at all with figuring out this AND query stuff will be GREATLY appreciated.... and thanks in advance!!!

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-02 : 15:00:07
You should not be playing with cold fusion or web pages or anything until you have figured out the SQL Statements and understand how to get this to work. Why have you completely removed the code I gave you? You said you could not get things to work, but didn't even post what you tried?

If you have a SQL problem to solve, ignoring it and hoping that somehow cold fusion will solve it for you probably isn't the best way to figure it out .... go back to square 1, analyze the SQL I gave you, test it, work it out on paper, read up on how GROUP BY and HAVING work, test it on a small sample of data, tweak as needed.

- Jeff
Go to Top of Page
   

- Advertisement -