Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ASPSQLVB
Starting Member
46 Posts |
Posted - 2006-11-18 : 20:46:28
|
Guys, I am still trying to figure this one out. I have 2 seperate fields....first one is Lbs and the other is Oz. I would like to get Max(Lbs) and the Oz that go with the Max(Lbs) I figured someething like this would work but, it does not. Select Max(Lbs) as MaxLbs, Oz from Table Where FishId = 232 Group By MaxLbs |
|
ASPSQLVB
Starting Member
46 Posts |
Posted - 2006-11-18 : 20:53:56
|
FIGURED IT OUT..........Select * from Fish Where Lbs=(Select Max(Lbs) from Fish Where FishId = 232) |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-11-18 : 21:15:10
|
This would have been much more straightforward with a design that stored the weight of a fish in a single column, rather than in two separate columns. You could have everything in the oz column, dropped the lbs column, and let the front end worry about converting 161oz to 10lb, 1oz. Just a thought for next time. SqlSpec - a fast, cheap, and comprehensive data dictionary generator forSQL Server 2000/2005 and Analysis Server 2005 - http://www.elsasoft.org |
 |
|
ASPSQLVB
Starting Member
46 Posts |
Posted - 2006-11-18 : 21:17:23
|
Jezemine, Makes sense now. Wish I thought of it then. The problem still exists. False alarm on solving it. All I got was closer to figuring it out. |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-11-18 : 22:18:04
|
so, if what you want is the biggest fish with id 232, have you tried this:select max((16 * lbs) + oz) from fish where fishid=232also, it looks like this is not the only thread you have started on this topic. It's better to stick to the original thread and not create new ones - it won't get your question answered any faster to start 3 different threads on it. It's just annoying. I think a moderator ought to lock this thread, and this ought to be locked too: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75170This one seems to be the main thread:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75156 SqlSpec - a fast, cheap, and comprehensive data dictionary generator forSQL Server 2000/2005 and Analysis Server 2005 - http://www.elsasoft.org |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-11-18 : 22:44:52
|
Duly locked. Please stop cross-posting. |
 |
|
|
|
|
|
|