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
varsha dodiya
NA
407
75.2k
group by clause in sql query
Aug 7 2014 3:16 AM
friends ,
I am trying to extract data performing some arithmetic operation (division and modules) for desired result
i applied query
SELECT S_P_name, S_P_pack,
SUM(S_P_ttoqty) / S_P_pack AS ost
, SUM(S_P_ttoqty) % S_P_pack AS otb,
SUM(S_P_ssold) / S_P_pack AS sst
, SUM(S_P_ttsold) % S_P_pack AS stb,
SUM(S_P_sqty) / S_P_pack AS pst
, SUM(S_P_ttqty) % S_P_pack AS ptb,
SUM(S_P_savail) / S_P_pack AS ast
, SUM(S_P_ttavail) / S_P_pack AS atb,
SUM(S_P_grsv) AS grs
FROM STOCK
GROUP BY S_P_name, S_P_pack
it is giving me result as i want but
ost , sst ,pst and ast are giving result of devision in decimal (like 11.916666) but i want it to show like 11 only
help me in getting this value type. thanks in advance . :)
Reply
Answers (
2
)
check for column value and update value in that row in sql
sql stored procedure conditional