I have the following query which gives the latest date_announced for MAX(date_announced) but doesnt give the corresponding value for software_product_build? how do I get it the corresponding software_product_build value for MAX(date_announced)?
select
software_product_build,
MAX(date_announced) as date_announced
from software_product_builds
group by software_product_id
One case:-
select software_product_build,
MAX(date_announced) as date_announced
from software_product_builds
where software_product_build LIKE '%QCA6290.LA.0.1%' group by software_product_id;
OUTPUT:-
|------software_product_build------|-------date_announced------|
--QCA6290.LA.0.1-00001-STD.INT-6---|------2017-03-13 21:13:32---
select software_product_build from software_product_builds where date_announced='2017-03-13 21:13:32';
OUTPUT:-
CI_QCA6290.LA.0.1-03091-STD.INT-61
First you need to get max date for every softwared prduct id then you can find software product build for that max date.
Select spb.software_product_build, Tmp.date_announced from software_product_builds spb join (Select software_product_id, MAX(date_announced) as date_announced from software_product_builds group by software_product_id) as tmp on (tmp.software_product_id=spb.software_product_id and tmp.date_announced=spb.date_announced)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.