?

Log in

No account? Create an account

Previous Entry | Next Entry

Is it just because I'm sick?

I am sick. It is unpleasant.

But.

There has GOT to be an easier way to do this--doesn't there?

I just spent _two hours_ on this, so I don't know. Trying to get the id associated with the minimum sort order of each set of images for a given set of "stock number"s.

SELECT min(i1.id) as id, i1.stock_number, i1.sort FROM inv_image_groups i1, (SELECT max(sort) as sort, stock_number FROM inv_image_groups GROUP BY stock_number) as i2 WHERE i1.stock_number IN (SELECT distinct stock_number from inv_image_groups) AND i1.stock_number = i2.stock_number and i2.sort = i1.sort GROUP BY i1.stock_number;

Essentially, there can be any number of images associated with a given vehicle, each with a sort order so we know how to display them. When listing a bunch of vehicles, I want to pull each image with the lowest sort order for each vehicle, to just show that one thumbnail.

Bah.

Comments

( 3 comments — Leave a comment )
kari_marie
Mar. 20th, 2006 07:18 am (UTC)
If it makes you feel any better, I'm in research paper hell, compounded by the fact that lame-ass security people won't let me get to my work computer until tomorrow and the bulk of my research is there and the paper was due at 11:00 PST (17 minutes ago.)

Maybe if I send the prof the news article explaining the bomb threat and subsequent campus-closing she'll let me turn it in tomorrow. Ugh.
kaolinfire
Mar. 20th, 2006 07:19 am (UTC)
Ew. =/
kakubeki
Mar. 20th, 2006 08:41 pm (UTC)
Oh, btw - stop being sick.
( 3 comments — Leave a comment )

Latest Month

February 2016
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
2829     

Tags

Powered by LiveJournal.com
Designed by chasethestars