jasongr
07-16-2006, 09:07 AM
Hi
I have the following table:
CREATE TABLE `image_info` (
`Image_ID` int unsigned not null auto_increment,
`Width` int unsigned not null,
`Height` int unsigned not null,
PRIMARY KEY (`Image_ID`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I would like to run a query that will return the first 10 random images. However, I would like to give preferences to horizontal images (i.e: width > height)
does anyone know how this can be achieved?
something like:
select *
from image_info
order by rand(), (width - height)
limit 0, 10;
any ideas?
I have the following table:
CREATE TABLE `image_info` (
`Image_ID` int unsigned not null auto_increment,
`Width` int unsigned not null,
`Height` int unsigned not null,
PRIMARY KEY (`Image_ID`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I would like to run a query that will return the first 10 random images. However, I would like to give preferences to horizontal images (i.e: width > height)
does anyone know how this can be achieved?
something like:
select *
from image_info
order by rand(), (width - height)
limit 0, 10;
any ideas?