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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 projection from a query

Author  Topic 

pritesh1908
Starting Member

4 Posts

Posted - 2012-04-25 : 20:57:08
i am trying to write a query that would do the following on the view update_winnerlist which is already GROUPed BY item_index

SELECT email_id
(SELECT email_id,min(bid_amount)
FROM update_winnerslist AS a1
WHERE a1.item_index = 10 )

i need to perform the above in a single query as i am using it in a trigger to update a table.
PLZ HELP

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-25 : 21:41:47
Don't quite understand what are you trying to achieve. Please post your table schema, sample data and expected result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pritesh1908
Starting Member

4 Posts

Posted - 2012-04-25 : 22:03:56
the update_winnerslist table contains mail_id,item_index,bid_amount attributes.The table is already grouped by item_index.
I am trying to get the email_id for item_index=10 with the lowest bid_amount i.e. the email_id of the person who made the lowest bid on item_index 10.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-25 : 22:06:17
please take a look here http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -