Web development blog

Tag: nesting

Double select from a single table in complex SQL query.

Jun.02, 2009

When I start learning SQL I have to write a lot of nested queries when working on complex select statements from a single table. Now, I feel more comfortable with it and show how to avoid nesting. There are cases when you have to compare one row of the table with all others to get the result:
  • Select next element to current by the value of some field
  • Select records that are unique by some complex expression
  • Select all records that have the same parameter as given record.
You can get rid of nesting in all above cases. Let’s review the example. (continue reading…)
Leave a Comment :, , , more...

The Content of this blog can be published anywhere with the link to original source.