This will Select correctly based on the question above, hope this helps someone else. Cheers.
SELECT
Id,
LastModifiedDate,
(
SELECT
Id,
CreatedDate
FROM FeedComments
ORDER BY CreatedDate ASC
)
FROM UserFeed
WHERE (
(
ParentId = {$this->uid}
)
AND (
LastModifiedDate > {$this->lastModStamp}
)
)
OR (
(
CommentCount > 0
)
AND (
CreatedDate > {$this->lastModStamp}
)
)
ORDER BY CreatedDate DESC;
A good way to test this is to flip the
OR ((CreatedDate > YESTERDAY) AND (CommentCount > 0))
to
OR ((CreatedDate < YESTERDAY) AND (CommentCount > 0))
and use something like this to run through it
header('Content-Type: text/plain');
$query = str_replace('{/id}', "'".SF_UID."'", $_POST['q']);
$response = $mySforceConnection->query($query);
$sResult = New QueryResult($response);
$i=0;
foreach ($sResult as $splObject)
{
echo "ID: {$sResult->records[$i++]->Id[0]}\n";
print_r($splObject->fields);
echo "\n\n";
if (is_array($splObject->queryResult))
{
$fResult = New QueryResult($splObject->queryResult[0]);
$j=0;
echo "\n---------------------------------------------\n";
foreach ($fResult as $fplObject)
{
echo "ID: {$fResult->records[$j++]->Id[0]}\n";
print_r($fplObject->fields);
echo "\n\n";
}
echo "\n\n\n\n\n\n";
}
}
}