Jump to content

< MIN


jonniejoejonson

Recommended Posts

I am trying to get the select the mediaId with the smallest mediaOrder..

 

SELECT mediaId, MIN(mediaOrder) FROM cms_media_on_pages AS mop

WHERE userId='3'

GROUP BY pageIdI am trying to get the select the mediaId with the smallest mediaOrder..

 

SELECT mediaId, MIN(mediaOrder) FROM cms_media_on_pages AS mop

WHERE userId='3'

GROUP BY pageId

 

 

This selects the min mediaOrder but not the mediaId with the smallest mediaOrder?...

I would have thought this to work but it doesnt...

 

SELECT mediaId FROM cms_media_on_pages AS mop

WHERE userId='3' AND  MIN(mediaOrder)

GROUP BY pageId

 

 

This selects the min mediaOrder but not the mediaId with the smallest mediaOrder?...

I would have thought this to work but it doesnt...

 

SELECT mediaId FROM cms_media_on_pages AS mop

WHERE userId='3' AND  MIN(mediaOrder)

GROUP BY pageId

Link to comment
https://forums.phpfreaks.com/topic/231937-min/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.