Click to See Complete Forum and Search --> : Search multiple tables (news, events, etc.)


calliepeck
01-12-2009, 11:10 PM
Hi all,

So I'm generally a PHP coder and ASP VBscript screws with my head. I can't for the life of me figure out how to do a search across multiple tables and then sort that result by date. Specifically, I am searching press and events. The table fields don't necessarily correspond and they will display differently in the search. I'm losing my mind.

My thought was to do two separate queries and then combine the results into a multidimensional array (actually using ArrayList class to easily add values). Each entry would be its own definition, which I understand to be the equivalent of an associative array. Of course, I am having no luck sorting that by key. I can give you my code for that, but I figure there's probably a better way to do this whole thing anyway.

Any help would be terribly appreciated,

Thanks!

buntine
01-13-2009, 08:52 PM
Theoretically, you could cover all of this at the database layer by either writing a somewhat complex SQL query, or (depending on your database) writing a stored procedure that extracts and transforms the data and schema into a common format.

In ASP, the query results will be presented as an ADO dataset object, which is really just a wrapper around a linked-list data structure so you can traverse the result-set with ease.

The idea you have presented could work, although it is a fairly low-level approach considering you would have to iterate the array and sort it manually based on dates, etc.

Cheers.

calliepeck
01-14-2009, 09:28 PM
Hmm. Any advice on formatting that SQL query? I haven't worked with stored procedures before, so that's a little scary sounding. My next thought was running the whole thing through AJAX and sorting it that way (oh, also haven't worked with AJAX in like two years). I'm so lost though.