Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » how to write SQL query
Search Topic:
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
I need some of you guys help on here. »
« Anyone here familar with CS3 Flash?  
AuthorAll Replies


Ray
Mahnahmahna
Premium
join:2001-04-02
Mesa, AZ


edit:
May 11th, @04:47PM

reply to jayco437
Re: how to write SQL query

That's what I was thinking. It's slow because that subselect is re-run for every row in the outer query. First, I'd create an index on the comment date if there isn't one already and see if that becomes acceptable.

Secondly, I'd try to make a query of the latest comment for each invoice a one-time deal as part of the FROM clause using a table alias. I'd need to create some test data & play with it for a while to actually give you some specific SQL, but something along the lines of

SELECT i.blah, c.comment
FROM invoices i
JOIN (SELECT most recent comment for each invoice) c
ON (c.invoice_id = i.invoice_id)
--
ON DELETE CASCADE
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersI need some of you guys help on here. »
« Anyone here familar with CS3 Flash?  


Thursday, 04-Dec 23:54:06 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 9 years online! © 1999-2008 dslreports.com.
page compression OFF
Most commented news this week
· [125] AT&T Metered Billing Trial Hits Second Market
· [97] UDP BitTorrent Will Destroy The Interwebs!
· [94] Exclusive Screens Of Comcast's New Bandwidth Meter
· [91] AT&T Cutting 12,000 Jobs
· [90] EFF Challenges Telecom Immunity
· [83] Firefox Extension Leads Amazon Customers To Pirated Alternatives
· [70] Scott Cleland: Google Using 21x The Bandwidth They Pay For
· [63] Apple: Who Believes Our Ads Anyway?
· [62] Comcast Tries To Slow Verizon's Philly Entry
· [60] Comcast To Offer Bandwidth Use Tracker In January
Most people now reading
· [game] Crazy Game Fun Time!!! [Pub Games]
· Garage Door Track Pulled Off Wall? [Home Repair & Improvement]
· Always leave the Windows Firewall on? [Security]
· why do people freak out on planning a wedding? [General Questions]
· [WotLK] State of the Holy Pally [World of Warcraft]
· Switched to TekSavvy and now I got a $469 bill from BELL!! [TekSavvy]
· many sites not loading [Road Runner]
· Is this a good thing for the net? [news,99366]
· [Free] TuneUp Utilities 2007 - free full lic. [Software]