Now, as I understand when you use aggregate functions such as AVG
, SUM
etc you have to keep in mind that any other fields you SELECT
that aren't also involved in an aggregate function will be indeterminate, for example:
SELECT AVG(amount), name, desc FROM some_table;
I understand this and this is because the value coming from the aggregate function isn't tied to any one row and hence the other fields selected are indeterminate.
However, if you use a different type of aggregate function such as MIN
or MAX
where what they retrieve is tied to a certain row then is it safe to assume that any other fields selected that aren't within an aggregate function can be determined? ... as the result would be tied to a specific row of data unlike the other aggregate function results?
For example:
SELECT MIN(media_id),
auction_id,
media_url
FROM auction_media
WHERE auction_id IN( 119925, 124660, 124663, 129078,
129094, 134395, 149753, 152221,
154733, 154737, 154742, 157694,
161411, 165965, 165973 )
AND media_type = 1
AND upload_in_progress = 0
GROUP BY auction_id;
If I am right in my thinking this would always return the correct media_url
right?