select *, exists ( select * from orders where date between #date1# and #date2# ) as hasOrdered from customers order by name, id
Use CFQUERYPARAM, of course. cheers, barneyb On Mon, Apr 28, 2008 at 8:57 PM, Brian Sheridan <[EMAIL PROTECTED]> wrote: > I will try to make this as simple as possible. Any help would be greatly > appreciated. I have 2 tables like below. > > tblCustomers > =========================== > ID | Name | Email | > 1, John, [EMAIL PROTECTED] > 2, Bob, [EMAIL PROTECTED] > 3, Steve, [EMAIL PROTECTED] > =========================== > > > tblOrders > =========================== > UserID | Date| > 1, 12/22/2007 > 3, 1/2/2008 > > =========================== > > > I want to do a query like a scorecard view, that will list all CUSTOMERS > and show "yes or "no" if they had an order bewtween 2 dates. > > > > RESULTS WOULD BE LIKE THIS IF I SEARCH BETWEEN 12/01/2007 - 1/30/2008 > ------------------------------------------------- > ID | Name | Email | > 1, John, YES > 2, Bob, NO > 3, Steve, YES > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304375 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4