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
 pls i need your help in my SQL Query statement

Author  Topic 

musab2012
Starting Member

1 Post

Posted - 2013-04-02 : 02:45:41
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;

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-04-02 : 05:26:05
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
   

- Advertisement -