dominornovus

Joining two rows from the one table

Apr 22nd, 2013
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.44 KB | None | 0 0
  1. SELECT fsmall.category, fsmall.title, fsmall.description, fsmall.id AS Small_Id, fsmall.VALUE AS Small_Value, flarge.id AS Large_Id, flarge.VALUE AS Large_Value
  2. FROM my_table fsmall JOIN
  3.      my_table flarge
  4.      ON fsmall.subcategory = 'small' AND flarge.subcategory = 'large' AND
  5.         fsmall.category = flarge.category AND
  6.         fsmall.title = flarge.title AND
  7.         fsmall.description = flarge.description
  8. WHERE fsmall.category = "Fruit"
Advertisement
Add Comment
Please, Sign In to add comment