Hello All,
I've never done this type of query before and I'm hoping I can gain some insight. I have two databases that I want to match on a date field. I tried using a single SQL statement, but because I have two different field types (timestamp and date), I used different queries and converted both to be in the format of 'yyyymmdd'.
This part works fine. But when I try to intersect the matching dates, I get 'Array' as a result. So I take this to mean there is more than one match? But I don't see how this can be because there are only two entries in one table, and both dates are different. Here is my code snippet:
cSQL = "SELECT LEFT(dtstamp,8) FROM Event";
$result2 = mysql_query($cSQL, $db1);
while ($myrow = mysql_fetch_row($result2)) {
$cDate = array($myrow[0]);
}
$rSQL = "SELECT date1,rID FROM report";
$result = mysql_query($rSQL, $db2);
while ($myrow = mysql_fetch_row($result)) {
$rDate = str_replace("-","",array($myrow[0]));
$rID = array($myrow[1]);
}
$Final= array_intersect($rDate, $cDate);
Arrays just thouroughly confuse me, so sorry about the mess. Any help will be appreciated!
Geogal
🙂