SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

musab2012
Starting Member

Australia
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

3.1.1.
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 ,,

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


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

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 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.

Cheers
MIK
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000