Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 pls i need your help in my SQL Query statement
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 04/02/2013 :  02:45:41  Show Profile  Reply with Quote
Hi brothers

pls guys i need some one help me about this Question

List all columns of all rows in the STOCKITEM table in ascending primary key sequence.
Only list rows where the selling price is greater than the purchase price multiplied by 3 or the
selling price is less than the purchase price multiplied by 2 ??

i did this stastment but the ruselt not come with multiplied by 2 or 3 ,,

FROM stockitem
where sellprice > purchprice *3
or sellprice < purchprice *2
order by stkid asc;

Edited by - musab2012 on 04/02/2013 02:57:50

Flowing Fount of Yak Knowledge

1054 Posts

Posted - 04/02/2013 :  05:26:05  Show Profile  Reply with Quote
Well there might not be any record as per where condition.

SELECT SellPrice,PurchasePrice*3 As PuchMultiplyThree, PurchasePrice*2 as PurchMultiplyTwo FROM StockItem;

Check if there is any SellPrice value which is "greater than col2" OR "Less than col3" of the above query? If no then the query should not return any record at all.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000