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 |
Dcalladi
Starting Member
2 Posts |
Posted - 2012-02-24 : 10:17:48
|
I have two tables Test_items and Stock_levelsi want to get the name from the Test_items and the current stock , min sotck and max stock from Stock_levels and the condition is that current stock need to be smaller than 1i triedSELECT Test_items.Name, Stock_levels.Current_Stock, Stock_levels.Min_Stock, Stock_levels.Max_StockFROM Test_items , Stock_levelsWHERE Stock_levels.Item_Id = (SELECT Item_id FROM Stock_levels WHERE Current_Stock < 1) ANDStock_levels.Item_Id = Test_items.Idthis gives me #1242 - Subquery returns more than 1 rowovbiously becuase of the nested query. i am just wondring if there is a way to do it without a nested solution so it works or if there is just another way of doing it. |
|
X002548
Not Just a Number
15586 Posts |
|
Dcalladi
Starting Member
2 Posts |
Posted - 2012-02-24 : 10:37:43
|
That worked thank you very very much |
|
|
|
|
|