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
Goran Bibic
482
2.9k
197.8k
Sum column from multiple tables and diff sql
May 27 2018 6:12 AM
Need to select multiple column from multiple tables sum and difference
Some help?
select a.naziv as
'Naziv artikla'
, SUM (cast(a.kolicina as
float
)) as
'Nabavka'
, SUM (cast(b.kolicina as
float
)) as
'Prodaja'
, b.roba as
'Naziv artikla2'
FROM (a.naziv, a.kolicina from ulazni_racun_roba_roba as a
union
all select a.naziv, a.kolicina from mp_ulazni_racun_ostalo_roba as a
union
all select b.roba, b.kolicina from mp_racun_roba as b
union
all select b.roba, b.kolicina from mp_faktura_roba as b) as alltables
select (a.kolicina-b.kolicina) as UKUPNO
group by naziv
Reply
Answers (
4
)
Sum if is value varchar
Split string based on values