使用mysql表中的信息从连接中删除数据

I have created a JOIN to display the data I need to allow the user to see all the stories available for them to choose.

$sql = ("
SELECT * 
  FROM guest
     , story 
 WHERE guest.userid = story.userid 
   AND guest.userid = $_SESSION[id] 
 ORDER 
    BY story.st_name  
");
$result = mysqli_query($db, $sql);

echo "<table class='p'>";
echo "<tr>";
echo "<td class='z'>Story Name</td>";
echo "<td class='z'>Email</td>";
echo "</tr>";

while($row = mysqli_fetch_array($result)) {
$st_name    = $row['st_name'];
$email      = $row['email'];
$st_id      = $row['st_id'];
$g_id       = $row['g_id'];
$first_name = $row['first_name'];
$last_name  = $row['last_name'];

echo "<tr>";
echo "<td class='b'>".$st_name."</td>";
echo "<td><input type='checkbox' name='checkbox[]' class='checkboxes' value='$row[st_id],$row[g_id],$row[first_name],$row[last_name],$row[st_name]' >".$email."</td>";
echo "</tr>";
}

This data then can be saved into a database table. All this works fine. However when they call the page again the same data shows up again and if they select the same data it will be repeated in the table.

This statement shows the data in the table that was saved.

$sql = ("SELECT * FROM gs WHERE id = $_SESSION[id] ");
$result = mysqli_query($db, $sql);

while($row = mysqli_fetch_array($result)) {
$firstname     = $row['first_name'];
$lastname      = $row['last_name'];
$storyname     = $row['story_name'];
$stid          = $row['st_id'];
$storyname     = $row['story_name'];

Some how I would like to create in the original SELECT statement a way to test and see if this data exists and then not show it. But I am not able to figure out such a statement.