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 |
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-07-28 : 06:58:25
|
| I have 2-tables [1.mprmst 2.quotemst]mprmst :mpr_no itm_code itm_qty10 ABC1 10010 FGH2 2011 ABC3 1512 AGH1 25quotemst:item_code unit_priceABC1 15ABC2 16ABC1 12FGH2 17ABC1 14.50Now I want to select the minimum value of unitprice for a particular mpr_no. I tried the below, showing error select mprmst.itm_code,mprmst.itm_qty,min(qotemst.unit_price) as unit_rate from mprmst,qotemst where mprmst.mpr_no='" & Sel_Mpr & "' and qotemst.item_code=mprmst.itm_codeParamu @ PARANTHAMAN |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-28 : 06:59:09
|
are you using SQL 2000 or 2005/2008 ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-07-28 : 07:12:01
|
| sqlserver 2008Paramu @ PARANTHAMAN |
 |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2009-07-28 : 07:24:55
|
| You are missing the group by clause for other fieldsselect mprmst.itm_code,mprmst.itm_qty,min(qotemst.unit_price) as unit_rate from mprmst,qotemst where mprmst.mpr_no='" & Sel_Mpr & "' and qotemst.item_code=mprmst.itm_codegroup by mprmst.itm_code,mprmst.itm_qty |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-07-28 : 09:02:49
|
| NICE GUIDENCES!!!!!!THANKS!!!Paramu @ PARANTHAMAN |
 |
|
|
|
|
|