har en SELECT sats som har GROUP BY nu skulle jag behöva få med en kolumn som inte har någon arregate funktion I SELECT'n, utan tas beroende på värde i en annan kolumn, hur göra?group by
SQL satsen:
SELECT storage_tank.Storage_Tank_ID, max(customer.Customer_Name) AS Customer, max(pejl_placement.Placement_Name) AS Placement, max(level_logg.Level_Logg_Timestamp) AS Timestamp, max(level_logg.Level) AS Level, max(storage_tank.Full_Volume) AS F_Volume, max(pejl.PEJL_ID) AS Pejl, max(product.Product_Name) AS Product
FROM level_logg
INNER JOIN storage_tank ON level_logg.Storage_Tank_ID = storage_tank.Storage_Tank_ID
INNER JOIN pejl ON storage_tank.Pejl_ID = pejl.Pejl_ID
INNER JOIN pejl_placement ON pejl.Pejl_Placement_ID = pejl_placement.Pejl_Placement_ID
INNER JOIN customer ON pejl.Customer_Number = customer.Customer_Number
INNER JOIN product ON storage_tank.Product_ID = product.Product_ID
GROUP BY storage_tank.Storage_Tank_ID
vill inte ha max på level utan den ska tas beroende på timestamp.
.p