Here is all of my php so that you can understand my sql and know that I can't and this conditional statement in the sql
<?php
// Get a database object
$db = JFactory::getDBO();
$query = "SELECT list.ID, list.DFirstName, list.DLastName, list.event1, list.event2, list.location, list.fun, list.visit, list.recplace_id, list.funplace_id, list.cemplace_id, list.fundate, list.Picture, list.info1, list.info2, list.info3, list.info4, list.info5, list.info6, list.info7, list.info8, places.place_name AS funplace, places.address AS funplaceaddress, places.city AS funplacecity, places.state AS funplacestate, places.zip AS funplacezip, places.country AS funplacecountry, places_1.place_name AS recplace, places_1.address AS recplaceaddress, places_1.city AS recplacecity, places_1.state AS recplacestate, places_1.zip AS recplacezip, places_1.country AS recplacecountry, places_2.place_name AS cemplace, places_2.address AS cemplaceaddress, places_2.city AS cemplacecity, places_2.state AS cemplacestate, places_2.zip AS cemplacezip, places_2.country AS cemplacecountry
FROM deceasedlist
INNER JOIN places ON list.funplace_id = places.place_id
INNER JOIN places AS places_1 ON list.recplace_id = places_1.place_id
INNER JOIN places AS places_2 ON list.cemplace_id = places_2.place_id
WHERE list.ID = '$_GET[ID]'";
$result = mysql_query($query)
or die("Couldn't execute query.");
$row = mysql_fetch_array($result);
extract($row);
print "<center>
<table width=\"400\">
<tr><td>";
print "<form action='./send?ID=$ID' method=\"post\" name=\"FormName\"><input type=\"submit\" value=\"Send A Letter\" border=\"0\"></form></td><td><form action='./letters?ID=$ID' method=\"post\" name=\"FormName\"><input type=\"submit\" value=\"View letters\" border=\"0\"></form></td>
</tr>
</table>
</center><br><br><center>";
if($Picture == "") print "";if($Picture != "") print "<img src=\"$Picture\" alt=\"$DFirstName $DLastName\" height=\"169\" width=\"133\" border=\"0\"><br>";
print "<b>$DFirstName $DLastName</b></center>";
print "<br><br>
<b>Event 1</b>: "; print date('F j, Y',strtotime($event1));
print "<br>
<b>Event 2</b>: "; print date('F j, Y',strtotime($event2));
print "<br><br>";
print $Location;
print "<br><br>";
if ($recplace_id > 0 && $fundate >= date)
print $visit;