Posted By

sullei on 07/30/11


Tagged


Versions (?)

next prev


 / Published in: SQL
 

  1. SELECT product_id,
  2. (SELECT product_id FROM jos_vm_product p WHERE product_id < 22 ORDER BY product_id DESC LIMIT 1) AS `left`,
  3. (SELECT product_id FROM jos_vm_product p WHERE product_id > 22 ORDER BY product_id ASC LIMIT 1) AS `right`
  4. FROM jos_vm_product
  5. WHERE product_id = 22

Report this snippet  

You need to login to post a comment.