Ok here is my perdicament. Yours worked fine
<cfquery name="qgetitems" datasource="#DSN#">
SELECT *
FROM SI_ITEMS2
WHERE SI_ITEM_ID IN (#SI_Item_ID#)
AND SI_Opsrpt_ID = #qgetsi.SI_Opsrpt_ID#
</cfquery>
however what I am really trying to do is get a count.
So say there are 3 SI_OPSRPT_ID's
and i pass 5 item_ids i want to do a count of how many times
each ITEM shows up within those 3 reports.
I'm still somewhat new at getting things to query and display properly.
would want the output to be something like.
>From this date to this date (i pass the date range thats what determines how
many SI_opsrpt_id's will be included):
There were 7 instances of this Item.
???
Kelly
---------------------------------------
Kelly Matthews
Internet Development Coordinator
AAAE
703.578.2509
[EMAIL PROTECTED]
http://www.airportnet.org
---------------------------------------
> -----Original Message-----
> From: Ben Forta [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 10, 2000 1:45 PM
> To: [EMAIL PROTECTED]
> Subject: RE: QUERY QUESTION
>
> Robert, actually, that would not work. As the same query name is used each
> time each subsequent query would overwrite the prior one. If you ever need
> to execute queries in a loop like that you must be sure to
> programmatically
> adjust the query name as well (perhaps by using a counter).
>
> --- Ben
>
>
> -----Original Message-----
> From: Hinojosa, Robert [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 10, 2000 1:36 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: QUERY QUESTION
>
>
> Put the loop outside the query tag.
>
> <cfloop list="#SI_Item_ID#" index="TheItem">
> <cfquery name="qgetitems" datasource="#DSN#">
> SELECT *
> FROM SI_ITEMS2
> WHERE SI_ITEM_ID = #TheITem#
> AND SI_Opsrpt_ID = #qgetsi.SI_Opsrpt_ID#
> </cfquery>
> </cfloop>
>
>
> Robert Hinojosa
> WebDeveloper
> 512.912.3775
> [EMAIL PROTECTED]
> www.cirrus.com
>
> -----Original Message-----
> From: Kelly Matthews [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 10, 2000 12:14 PM
> To: '[EMAIL PROTECTED]'
> Subject: QUERY QUESTION
>
>
> Ok I have 2 queries I am running the first is:
>
> <CFQUERY datasource="#DSN#" name="qgetsi">
> SELECT *
> FROM SelfInspection
> WHERE 0=0
> <CFIF (IsDefined("form.date1")) AND (IsDefined("form.Date2"))>
> AND SI_dt BETWEEN #CREATEODBCDate(form.date1)# AND
> #CREATEODBCDate(form.date2)#
> </CFIF>
> </CFQUERY>
> This runs fine...
>
> Next one is:
>
> <cfquery name="qgetitems" datasource="#DSN#">
> <cfloop list="#SI_Item_ID#" index="TheItem">
> SELECT *
> FROM SI_ITEMS2
> WHERE SI_ITEM_ID = #TheITem#
> AND SI_Opsrpt_ID = #qgetsi.SI_Opsrpt_ID#
> </cfloop>
> </cfquery>
>
> This seems to run fine but comes back with ONE record when it should come
> back with THREE:
>
> Results:
> qgetitems (Records=1, Time=0ms)
> SQL = SELECT * FROM SI_ITEMS2
> WHERE SI_ITEM_ID = 19 AND
> SI_Opsrpt_ID = 5
> SELECT * FROM SI_ITEMS2
> WHERE SI_ITEM_ID = 13
> AND SI_Opsrpt_ID = 5
> SELECT * FROM
> SI_ITEMS2
> WHERE SI_ITEM_ID = 15
> AND SI_Opsrpt_ID = 5
>
> It only appears to bring back ONE record however it should bring back 3
> because
> ID 5 is in there with item id 19,15 and 13 but it seems to only pick up
> and
> display the first one....
> Do I need to change my query????
> Kelly
> --------------------------------------------------------------------------
> --
> --
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> --------------------------------------------------------------------------
> --
> --
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
>
> --------------------------------------------------------------------------
> ----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.