അനർഗള നിർഗള പ്രവാഹം
  • ബഹിർസ്പുരണങ്ങൾ
  • Note Book
  • Family History
  • ബഹിർസ്പുരണങ്ങൾ
  • Note Book
  • Family History
Search by typing & pressing enter

YOUR CART

7/22/2013 0 Comments

SQL: Select the minimum and maximum values of a column grouped by another column for a given where clause.

select   p.version, min (p.launch_date) as first, max(v.launch_date) as last
from product p
where p.id = '1234'
group by p.version, p.id
order by  p.version

The above query selects the first and last launch dates for every version (major version number assumed) of a given product with id 1234
Picture
0 Comments



Leave a Reply.

    Archives

    July 2016
    October 2013
    July 2013
    June 2013

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.