I don't understand how to use the max() in sql while calling other columns. I understand that you need "group by" to use max() but I want to create a table that shows other columns and a max(). So far I tried a su
Here is my code:
| dbquery "routerDB" "select distinct DEVICE, LOCATION, MODEL,
METRO_AREA, REMOTE_DEVICE, (select location from tbl_device where device like REMOTE_DEVICE)
AS CLLI, SPEED AS CIRCUIT, device_number, max(sum(stats_value))
from tbl_device
inner join pdnce_ro1.lkp_location_edited
on tbl_device.device_loc=pdnce_ro1.lkp_location_edited.device_loc
inner join tbl_topology
on tbl_device.device=tbl_topology.local_device
where local_device like '%VP%' and remote_device like '%LR%'
and local_device like '%PHLAPA%' and device_number like '33'"
group by ???????? nothing works
I also tried using a subquery which works BUT it's dependent on another column like LOCATION... As in it needs the row's LOCATION to find the max. How do you do that???
↧