<div dir="ltr">2013/7/5 Riccardo Penco <span dir="ltr"><<a href="mailto:riccardo.penco@gmail.com" target="_blank">riccardo.penco@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px"><div>questa (non provata e in effetti abbastanza bizzarra...)??</div><div><br></div><div>select t1,articolo, min(t1.update) as update</div>
<div>from table t1</div><div> inner join (</div><div> select articolo, prezzo as ultimoprezzo, max(update) as update</div><div> from table </div></div><div style="font-family:arial,sans-serif;font-size:13px"> group by articolo, prezzo<br>
</div><div style="font-family:arial,sans-serif;font-size:13px"> order by update desc<br></div><div style="font-family:arial,sans-serif;font-size:13px"> limit 1</div><div style="font-family:arial,sans-serif;font-size:13px">
) t2 on t1.articolo = t2.articolo and t1.prezzo = t2.ultimoprezzo</div><div style="font-family:arial,sans-serif;font-size:13px">group by <span style="color:rgb(80,0,80)">t1,articolo</span></div><div style="font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(80,0,80)"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80)"></span></div></div></blockquote></div><br></div><div class="gmail_extra">eventualmente aggiungendo prima dell'ultimo group by</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">where t1.articolo in</div><div class="gmail_extra">(select articolo from table group by articolo having count(distinct prezzo) > 1)</div></div>