joined:Feb 22, 2009
I rarely post on here, but I have no choice as I don't really know enough to even know if this is possible, and as it isn't to do with a website I hope as that's Ok. It's all mysql related though!
SELECT `Column1`, `Column2` FROM `TableName` WHERE `Column3` = ' + USER_TEXT_HERE + ' ORDER BY `Column1`
Then `Column2` provides the key Id for this next query - this can be any number of records, so I use IN() after converting an array to comma separated values
SELECT `Column1`, `Column2`, `Column4` FROM `TableName1` WHERE `Column3` IN(QUERY_1_COLUMN_2) ORDER BY `Column1`
The same column then provides the next couple of queries (all the same format, but different tables).
Then While these queries are completed in a for loop. the data held in `Column1` from the first query is used to link up to the data from the subsequent queries to show histories from that initial enquiry!
Sorry If I have lost you by now, but my question is this - can I simplify this? It just seems a lot of loops and queries within loops when a temp table could possibly help (never done one though).
I can't change the structure of the db as it's in constant use and the powers that be say its to be left as is.
I'm even wondering if what I am after is even possible?