SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old July 21st, 2017, 03:22 PM
sdias sdias is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2017
Posts: 0 sdias User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 46 sec
Reputation Power: 0
How to join objects in multiple databases

Hi,
I would like to know if it is possible to join two different tables from different data bases? I am doing it through Excel by Microsoft Query.

The B10A3BDE is the data bases of the tables: SDD, RCM nad IIM.
TheAlliance_Sales.dbo is the data bases of the table: MSS_ECH

that's my command:

SELECT coalesce(zccl01.CCNOT1,'N/A') AS CCDESC, SDD.DDNUME, RCM.CNME, SDD.DDCLFO, RCM.CAD3, RCM.CZIP, RCM.CCOUN, SDD.DDITEM, SDD.DDDTEM, SDD.DDORCL, SDD.DDPEDV, SDD.DDVTBR, SDD.DDUFDE, SDD.DDTPOP, SDD.DDQTIT, SDD.DDVUBR, SDD.DDCNTB, SDD.DDIPI, SDD.DDVTBR, SDD.DDDPRF, SDD.DDDPRS, SDD.DDDPRO, SDD.DDDPFT, SDD.DDDIAI, SDD.DDICMS, SDD.DDPIS, SDD.DDCOF, ZCC.CCDESC AS FAMILY,

CASE SDD.DDTPOP
WHEN 'E'
THEN -((DDVTBR+DDDPRF+DDDPRS+DDDPRO+DDDPFT-DDDIAI-DDICMS-DDPIS-DDCOF))
ELSE (DDVTBR+DDDPRF+DDDPRS+DDDPRO+DDDPFT-DDDIAI-DDICMS-DDPIS-DDCOF)
END AS NET

FROM B10A3BDE.ALPLXBRF.SDD SDD, B10A3BDE.ALPLXF.RCM RCM, B10A3BDE.ALPLXF.IIM IIM

left join zccl01 on ipfdv=zccl01.cccode and zccl01.cctabl='GROUPTEC'

left join B10A3BDE.ALPLXF.ZCC ZCC ON ZCC.CCCODE=IIM.IREF01

left join Alliance_Sales.dbo.MSS_ECH on MSS_ECH.HORD=SDD.DDPEDV

WHERE (SDD.DDDTEM between '20170703' and '20170805')

AND (SDD.DDITEM=IIM.IPROD)

AND (SDD.DDCLFO=RCM.CCUST)

AND (SDD.DDNTOP Not In ('S0004','S0003'))

AND (SDD.DDACFO Not In ('5552','6552','5913','6913','5915','6915','5920', '6920','5551','6551','5949','6949','5901','6901'))

AND (SDD.DDCLFO Not in ('35002805','35005943','35005604','35005426','3500 5203','35004945','35004916','35004784', '35004740','35004346','35004333','35004058','35004 058','35003812','35003374','35042922','35002401',' 35042915','35042913'))

AND (RCM.CNME not like '%ESSENTRA%')

AND SDD.DDNUME=(SELECT SHC.HCNUME FROM B10A3BDE.ALPLXBRF.SHC SHC
WHERE SHC.HCNUME=SDD.DDNUME
AND (HCRS12='1')
AND (HCRS13='N')
AND (HCRS14=' ')
AND (HCRS15='S')
AND (HCRSB0='EM'))

ORDER BY SDD.DDDTEM DESC, SDD.DDNUME

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > How to join objects in multiple databases


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap