I'm assuming you want to 1) get the count of a field and 2) delete a number of rows according to a query, which is almost the same query you're using for the count.
My answer is no, you can't do a simultaneous select and delete, at least as far as I know. Your subquery would return too many values for the in statement of your delete query. Matthew Small IT Supervisor Showstopper National Dance Competitions 3660 Old Kings Hwy Murrells Inlet, SC 29576 843-357-1847 http://www.showstopperonline.com -----Original Message----- From: Bosky, Dave [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 11:10 AM To: CF-Talk Subject: RE: Proper SQL statements Hey Matt, So there's no way to include the count function within the delete query without an addition select statement? Something like > <CFQUERY Name="qRemoveCurrentFlapList" datasource="dsn"> DELETE FROM tbl_reports_FlapList WHERE FlapListID IN (SELECT FlapListID, COUNT(*) AS RecsAvailable FROM tbl_reports_FlapList) </CFQUERY> Regards, Dave Bosky Sr. Multimedia Web Designer Horry Telephone Cooperative, Inc. office: (843)369-8613 [EMAIL PROTECTED] -----Original Message----- From: Matthew Small [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 10:55 AM To: CF-Talk Subject: RE: Proper SQL statements Hi Dave, You're using SQL Server, right? Just put them together in a query separated by a semicolon. Matthew Small IT Supervisor Showstopper National Dance Competitions 3660 Old Kings Hwy Murrells Inlet, SC 29576 843-357-1847 http://www.showstopperonline.com -----Original Message----- From: Bosky, Dave [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 10:23 AM To: CF-Talk Subject: Proper SQL statements Is there a better more efficient way of writing these 2 queries such as combining them into a single query? I will eventually convert it into a stored procedure. <CFQUERY Name="qNumCurrentRecs" datasource="dsn"> SELECT COUNT(*) AS RecsAvailable FROM tbl_reports_FlapList </CFQUERY> <CFQUERY Name="qRemoveCurrentFlapList" datasource="dsn"> DELETE FROM tbl_reports_FlapList WHERE FlapListID IN (SELECT FlapListID FROM tbl_reports_FlapList) </CFQUERY> Regards, Dave Bosky Sr. Multimedia Web Designer Horry Telephone Cooperative, Inc. office: (843)369-8613 [EMAIL PROTECTED] HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

