jteixeira Posted November 10, 2006 Share Posted November 10, 2006 I have this Query ---->Select Infofin_prod.maquinaid,nicname,Infofin_prod.idprod,NomeProd,StockFrom Infofin_prod INNER JOIN Maquina on maquina.maquinaid=Infofin_prod.maquinaid INNER JOIN Stockss on stockss.maquinaid=Infofin_prod.maquinaid INNER JOIN Produtos on produtos.idprod=Infofin_prod.idprodGroup by Infofin_prod.maquinaid,nicname,Infofin_prod.idprod,NomeProd,StockOrder by StockI Want print a message if the Stock = 0, but i don't know i do it with a if condition Link to comment Share on other sites More sharing options...
aspnetguy Posted November 10, 2006 Share Posted November 10, 2006 I deleted your other 2 posts. Do not ask the same questions more than once. Be patient.what database are you using? It makes different when getting into this type of sql programming. Link to comment Share on other sites More sharing options...
jteixeira Posted November 10, 2006 Author Share Posted November 10, 2006 Microsoft SQL Server Management STudio Express Link to comment Share on other sites More sharing options...
aspnetguy Posted November 10, 2006 Share Posted November 10, 2006 try this http://doc.ddart.net/mssql/sql70/ia-iz_4.htm Link to comment Share on other sites More sharing options...
jteixeira Posted November 10, 2006 Author Share Posted November 10, 2006 But this only do to return one value, if i try this to return more then a value it doesn't work Link to comment Share on other sites More sharing options...
aspnetguy Posted November 10, 2006 Share Posted November 10, 2006 post your code Link to comment Share on other sites More sharing options...
jteixeira Posted November 10, 2006 Author Share Posted November 10, 2006 if(select stock from Stockss Where stock=0)=0Begin Print 'erro'EndErro ---> Msg 512, Level 16, State 1, Line 1Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Link to comment Share on other sites More sharing options...
aspnetguy Posted November 10, 2006 Share Posted November 10, 2006 this part (select stock from Stockss Where stock=0) potentially can have more than 1 record so the you cannot compare it to asingle value.You are better off tryign to handle this in your server side code. You can loop through the returned records in SQL but it is messy and confusing.Just return the query and process the records with PHP or something. Link to comment Share on other sites More sharing options...
jteixeira Posted November 13, 2006 Author Share Posted November 13, 2006 How i do it? can you help me? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now