TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bineesh Viswanath
NA
1k
780.8k
Need help to Divide two columns in SQL Server
May 11 2016 7:56 AM
Sir,
I need your help to create a sql query to divide two columns(rate,qty) and set the query result into a single row.
suppose my rate is 35000 and qty=5 I should get 7000.
Here I writing my sql query
select distinct
invopstock.opstock,
invopstock.rate,
invopstock.pid,
invpurchaseitems.pid AS PURCHASEPID,
invpurchaseitems.rate as PRATE,
sum(invpurchaseitems.amount/invpurchaseitems.qty) AS PURCHASEAMOUNT ,
invpurchaseitems.freeqty from invopstock,invpurchaseitems
where invopstock.pid=invpurchaseitems.pid and invopstock.pid=21
and invopstock.COMPCODE = 'MNA' AND invopstock.DIVCODE = 'DIV' AND INVOPSTOCK.OPSTOCK>0
and invpurchaseitems.isdeleted=0
group by
invopstock.opstock,
invopstock.rate,
invopstock.pid,
invpurchaseitems.pid,
invpurchaseitems.rate,
invpurchaseitems.freeqty
Reply
Answers (
1
)
SQL server error............................................
how to match data is not show in drop down