NYCPHP Meetup

NYPHP.org

[nycphp-talk] more queries, or bigger in-memory data structure ?

Analysis & Solutions danielc at analysisandsolutions.com
Thu Sep 18 16:44:14 EDT 2003


Hey David:

On Thu, Sep 18, 2003 at 03:34:11PM -0400, David Mintz wrote:
> 
> So even if I
> could figure out the LEFT JOIN syntax to left-join multiple tables in this
> way, if such is possible, it still wouldn't give me what I want.

With clever looping and comparisons, I bet you could get what you want 
with one query.

For exapmle, I've made some calendars where the items are ORDER BY
EventDate, StartTime.  I then loop through the results.  Before starting,
a variable named $LastDate is set to the date of the first record and a
date header is printed out.  While looping through, before displaying each
record, the $LastDate is compared to the current event date.  Once the 
dates are different, then the next date header is printed.

See http://www.bikesummer.org/calendar/ to see what I mean.

Similarly, you can use this principle to handle multiple sub-items.  Like, 
printing the Interpreter and Defendants only when the name changes.

Am I writing this clearly?

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list