title: Delete rows in sybase with joins
body: <p>I'm trying to run a query to delete all rows with specific ID's that do not have the most recent timestamp.  I am receiving an error telling me that the table "c" does not exist...</p>
  
  <p>Here is the query...</p>
  
  <pre><code>DELETE c
  FROM 
      "sac"."vendor_item_cost" c
  JOIN(
      SELECT
          c1.Vendor_id,
          c1.Item_Number,
          MAX(c1.Last_edit_timestamp) as [Date]
      FROM
          "sac"."vendor_item_cost" c1
      JOIN
          "sac"."vendor_item_cost" c2
      ON
          c1.Vendor_id = c2.Vendor_id AND c1.Item_Number = c2.Item_Number
      GROUP BY
          c1.Vendor_id, c1.Item_Number
  ) q
  ON
      c.Vendor_id = q.vendor_id AND c.Item_Number = q.Item_Number AND c.Last_edit_timestamp &lt;&gt; q.[Date]
  </code></pre>
  
  <p>Running a SELECT statement with the same code returns the correct rows that I am trying to delete without any problem.  See below...</p>
  
  <pre><code>SELECT 
      c.Store_number, 
      c.Vendor_id, 
      c.Cost, 
      c.Item_Number, 
      c.Last_edit_timestamp 
  FROM 
      "sac"."vendor_item_cost" as c
  JOIN(
      SELECT
          c1.Vendor_id,
          c1.Item_Number,
          MAX(c1.Last_edit_timestamp) as [Date]
      FROM
          "sac"."vendor_item_cost" c1
      JOIN
          "sac"."vendor_item_cost" c2
      ON
          c1.Vendor_id = c2.Vendor_id AND c1.Item_Number = c2.Item_Number
      GROUP BY
          c1.Vendor_id, c1.Item_Number
  ) q
  ON
      c.Vendor_id = q.vendor_id AND c.Item_Number = q.Item_Number AND c.Last_edit_timestamp &lt;&gt; q.[Date]
  </code></pre>
  
  <p>I've never worked with sybase before, am I just using the wrong syntax for a delete statement?</p>