NEWBIE ME: THANK YOU ALL SO MUCH FOR YOU HELP! you have given me lots of great help - I am embarrassed I still don't know how to SORT the result with quirky filemaker database issue as listed below... On Jan 23, 2015, at 9:15 AM, Andy McKenzie <amckenzie4@xxxxxxxxx> wrote: > It looks like FileMaker 12 does allow more complex queries: > http://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/ > > It looks like It's a pretty standard SQL query, now. Build the SELECT statement, then use ExecuteSQL() to run it. > > Andy hi Andy - as far as I know - your link is for "internal filemaker use" but not applicable to the web pub engine used in CWP for the web and php that I am using > of records or objects. You can use array_merge() to merge both arrays, > and usort() for sorting the merged array. > > However, as others have already pointed out, it is preferable to use a > single query if possible. > > -- > Christoph M. Becker SIMPLY PUT - HOW CAN I POST PROCESS my database query and *re-sort* it? ! Great - can you tell me - how do I use usort() or another php sort function with the filemaker database query result as described below? ------------------------- MORE NEWBIE QUESTIONS - Still need help... I'll skip a bunch of points and try to summarize quickly using filemaker v 11 and fmstudio (php) for web queries (http://fmwebschool.com) I did something special and was able to run a script in filemaker as part of the php query and get my complex search done with 1 query - fmsudio has sorting functions but they are killed by the method I used for unknown reasons - so I have a query result that I can loop through.... $test_result = $test_find->execute(); !!! BUT I NEED TO SORT IT BY SEVERAL KEY FILEDS like LastName, Company etc. So I am thinking I need to use some post process sorting functions to to this? -learning: all web links seems to show lots of php sort functions but they are all for simple arrays - not this database filemaker query my fmstudio code query looks something like this... --------------------------- .... query lines then ends with this $test_result = $test_find->execute(); then i loop thru like this <?php foreach($test_result->getRecords() as $test_row){ ?> <tr> <td> <?php echo $test_row->getField('Client_ID'); ?> <?php echo $test_row->getField('Contact_First'); ?> <?php echo $test_row->getField('Contact_Last'); ?> </td> <td> </td> <td> </td> <td> </td> </tr> <?php } ?> Q: I am confused: 1 - HOW DO I RE-SORT THIS BEFORE THE LOOP DISPLAY = $test_result ????? MUCH THANKS... -- Thanks, Dave - DealTek dealtek@xxxxxxxxx [db-15]