select id, category_id, name, min(price) as minprice
    from cat_pictures
group by category_id;

Done.  And no need for any windowing functions ...

>-----Original Message-----
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of forkandwait
>Sent: Monday, 25 August, 2014 11:19
>To: sqlite-users@sqlite.org
>Subject: Re: [sqlite] Window functions?
>
>Simon Slavin <slavins@...> writes:
>
>
>> Would you care to explain what advantages Window functions would give
>us
>that VIEWs and sub-SELECTs don't
>> give us ?  I'm not being contrary, I'd like to know.
>
>I have never compared lines of code between the various approaches, but
>window functions make it pretty simple to do rankings, moving averages,
>etc,
>while sub-SELECTS etc are much more convoluted.
>
>I think of window functions as syntactic sugar only, but still very nice
>and
>very useful for analytical work, less so for pure data store work.
>
>Compare the two SQL examples between Approach 2 and Approach 3 in the
>linked
>page:
>
>http://hashrocket.com/blog/posts/sql-window-functions
>
>Also, VIEWS are permanent and thus lead to clutter, though temporary
>views
>mitigate somewhat.
>
>I am not sure it would be the best use of developer time and energy, but
>like I say it would be great for us analysts who would like to do more
>SQL
>work without a server setup, and less SAS/ Excel/ R/ whatever.
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to