473,770 Members | 6,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with join on same table in two different dbs

I have two databases, db1 and db2, with the same table, TableA. I want to
select the records from TableA in db1 that have a LAST_UPDATE SomeDate.
Then I want to get the identical records in TableA from db2. However the
LAST_UPDATE dates will be different between db1 and db2. That's the point. If
they are different, then there were changes made to the record in db1. I'm
going to then process this further to find out what the changes were.

But right now I just want to construct an SQL statement that I can use in
code to return the data that I need. Ultimately, I'm going to run this code
on over 100 tables. That's why I need to apply some type of filter (i.e.
LAST_UPDATE SomeDate) in order to have this overall process completed in a
short time.

I guess the statement could just get all records where the LAST_UPDATE is
different between TableA in db1 and TableA in db2. But speed is important,
because ultimately I will apply it to the 100 tables.

Note that db1 is the current database and db2 is an external database.

So, for example, I would have thought the following would work:

------------------------------------------------------------------------------
--

SELECT A.*, B.* FROM [TableA] As A
LEFT JOIN (SELECT * FROM [C:\.....].[TableA]) AS B ON (A.FIELD1 = B.FIELD1)
AND (A.FIELD2= B.FIELD2) AND (A.FIELD3= B.FIELD3)
WHERE A.LAST_UPDATE #SomeDate#

------------------------------------------------------------------------------
--
What's happening right now is that all records from the table are being
returned. In the test case I should have had 1 record returned and instead I
got all of them (1500+)

Thanks.

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Dec 26 '06
40 2540
"rdemyan via AccessMonster.c om" <u6836@uwewro te in
news:6b58b553c2 9de@uwe:
However, it appears that Lyle no longer wants me to post in this
forum and that MVPs such as yourself will be backing him up.
Therefore, I will no longer post in this forum.
I'm not an MVP, but I see no reason for you not to post. Ignore
those who criticize you.

And ignore both Lyle and Larry's point -- I think they're completely
wrong.

Then again, I've had lots of interaction with you and know perfectly
well what you're like and what knowledge you have, and know that
Lyle's assertions are quite baseless.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #21
"Larry Linson" <bo*****@localh ost.notwrote in
news:P5fkh.2677 $%M1.1731@trndd c08:
I have no objection to anyone posting via "AccessMonster, " but am
unfamiliar with the advantages, if any, of doing so instead of
reading/posting to the newsgroup directly. I do know that some
believe they profit from the pro bono work of others.
If your ISP doesn't provide a news server you have to pay to
subscribe to one, or use one that is public. The Microsoft groups
can be accessed through MS's public news server, but CDMA cannot.
So, many people access CDMA through websites that repackage Usenet
posts, like AccessMonster. It's by far not the only website
repackaging CDMA content, as I've found when googling posts of my
own, and it annoys the hell out of me. The only thing worse than
that are the websites that subscribe to private listservs and then
post the messages on their website.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #22
"rdemyan via AccessMonster.c om" <u6836@uwewro te in
news:6b5a7be0dd 642@uwe:
I have no idea what your above statement means as I know of no
other way to get at this forum than through AccessMonster.
CDMA is just a Usenet group, available on any news server with a
full newsfeed. All AccessMonster does is republish it with a
(terrible) web interface. If you can find a public news server or
subscribe to a non-public one, you can post directly to Usenet,
without the intervention of the AccessMonster website.

[]
On the surface this objecton over posting in AccessMonster is
ludricous. If no one should be posting here, then shut it down,
and let us know where to post.
My objecions to AccessMonster are two-fold:

1. most of the people who post there have no idea about the
etiquette of quoting and don't quote anything at all from the
messages they are replying to. The result is that their messages
often come out of the blue with no context. You obviously understand
Usenet etiquette and quote appropriately, so that's not applicable
to you.

2. AccessMonster sells ads and makes money off of republishing
content that was posted on Usenet, a public forum where no one
profits from the posts. This annoys a lot of people, including me.
If I could prohibit AccessMonster from republishing my posts, I'd do
so.

Google Groups also sells ads, but they provide a full archive of all
of Usenet, going back to the beginning, as well as excellent search
functionality, so I don't mind their making money because they add
real value to the content.

But I can't see what value AccessMonster adds that justifies their
profiting from advertisements.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #23
"rdemyan via AccessMonster.c om" <u6836@uwewro te in
news:6b5b4a31a6 9d7@uwe:
You are the one being silly. The simple answer is he shouldn't
post the code if he objects to someone potentially making a profit
off of what he posts.
I think you're misreading the whole point. It's *AccessMonster* that
is being criticized for profiting from Lyle's (and everyone else's)
work, not someone like you who adapts his code to your own apps.

I object to AccessMonster, too, but there isn't a damned thing I can
do about it.

Any code I post in the newsgroup is posted for the explicit purpose
of allowing others to use it, even in commercial apps.

But I still find it very annoying that a website is republishing my
posts and selling ads and making money off of my work without
actually adding any significant value at all.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #24
"'69 Camaro" <Fo************ **************@ Spameater.orgZE RO_SPAM>
wrote in news:UL******** *************** *******@adelphi a.com:
>I've mentioned several times that I'm a
consultant in this forum and by profit I naturally thought he
meant.....

And that's why Larry tried so hard to explain it's
AccessMonster.c om that Lyle takes umbrage with, not that you're
profiting from the code he provides freely.
And Larry did a very poor job of wording it, as it was not until a
few posts back that I realized he was criticizing *only*
AccessMonster and not the present poster.

[]
>Frankly, I'm glad he has plonked me.

You may not like his demeanor at times, but Lyle is very, very
generous with his considerable knowledge and expertise. This is
not an event to celebrate.
I find Lyle's advice to be highly idiosyncratic and often not
helpful. I plonked him a long time ago because of that.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #25
"Larry Linson" <bo*****@localh ost.notwrote in
news:s2qkh.1080 $cI.1030@trnddc 05:
Now, let me add to what Gunny has said. Sometimes the best advice
we can give is "don't do it the way you have planned", because we
see a simpler way which we recommend. Sometimes when we do that,
we don't have, or take, the time to explain in detail why the way
we are recommending against is bad, and why the way we are
recommending is better.
The present poster is quite able to do that. If you're interested,
check out the long group of threads he's been involved in on
microsoft.publi c.access.replic ation, and you'll see a case where he
resisted advice, then came around, and then found out it wasn't
going to work anyway, and then figure out his own solution (which is
the problem he's working on in this particular thread).

He's stubborn -- very stubborn.

But he listens.

He may ask "WHY???" very forcefully, but he thinks about the
responses and doesn't just reject them out of hand as what you write
above implies.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #26
"'69 Camaro" <Fo************ **************@ Spameater.orgZE RO_SPAM>
wrote in news:vK******** *************** *******@adelphi a.com:
>I've switched over and am now poting in the Usenet group.

From Google Groups? Don't they show ads and "sponsored links"
with posts, too?
<g, d, & r>
Yes, but they actually provide a very useful service, quite unlike
AccessMonster.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #27
"Larry Linson" <bo*****@localh ost.notwrote in
news:ivckh.955$ Ej7.943@trnddc0 2:
One of Lyle's points is that you post in the newsgroup via
"AccessMons ter" which he perceives as profiting from work done
"pro bono" by many in this and in other Access newsgroups.
I've been through a very long thread in the replication newsgroup
with this same poster. There, he doesn't post through AccessMonster.
Now, why would that be? Perhaps it's because Microsoft provides a
public news server, and there isn't any public news server available
to him that offers CDMA.

[]
I'd point out that newsgroups are not intended for the purpose of
having "ready access to free consulting" but for learning...
learning by the poster, sometimes by the responder, and always for
others who read the exchange, as well.
In the long replication discussion, there's been a lot of learning
and valuable discussion on both sides. I really don't see why Lyle's
reacted the way he has. I've had extremely detailed interactions
with this poster, and while he's *very* stubborn, he's not dumb (and
when it comes to stubborn, nobody can out-stubborn me!).
If you become widely perceived, as you seem to be by
Lyle, as someone who uses the newsgroup to get someone else to
write your application for you, one little piece after another,
then it will be difficult to obtain help when you need it even if
it is within the intent of newsgroups.
He has done nothing at all like that on the replication issue.
Indeed, the problem this post is about is derived from his
abandonment of replication in favor of writing his own homegrown
synchronization code.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '06 #28
David W. Fenton wrote:
Any code I post in the newsgroup is posted for the explicit purpose
of allowing others to use it, even in commercial apps.
Both times?

Dec 27 '06 #29
"David W. Fenton" <XX*******@dfen ton.com.invalid wrote in
news:Xn******** *************** ***********@127 .0.0.1:
I find Lyle's advice to be highly idiosyncratic and often not
helpful.
I plonked him a long time ago because of that.
You find the advice of someone you plonked a long time ago to be highly
idiosyncratic and often not helpful?

How?

Lyle Fairfield
Dec 28 '06 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4520
by: jain-neeraj | last post by:
Hi, We have a problem in our mobile calls billing software. To solve it, I need an outer join in a complicated query. Following are the simplified tables with sample data: create table CONTROL1 (CTRL_NO number(2)); insert into CONTROL1 values (10); create table CONTROL2 (CTRL_NO number(2));
2
16739
by: michael | last post by:
Gotta post because this is driving me nuts. Trying to DELETE orphans. I can successfully: SELECT GroupID FROM Groups LEFT JOIN Users ON UsersID = UserID WHERE UsersID IS NULL; but when I try: DELETE FROM Groups LEFT JOIN Users ON UsersID = UserID WHERE UsersID
4
1371
by: Denis St-Michel | last post by:
Hello All, Hope some Guru will be able to help me with this. Let's take this example table A ------------------------------------------------------------------------------- id | TicketNo | evaluation | Username ------------------------------------------------------------------------------- 1 1 9 Jamie 2 1 8.5 ...
3
2203
by: Andy Visniewski | last post by:
Should be easy, but I've been trying to figure this out for about half an hour with no luck. There is a table 'Cybex' which has all the Cybex products we sell, and a table 'Datasheets' which contains a list of the datasheets available for products. Both tables have a PartNumber column. On with the problem. If i do SELECT * FROM Cybex, it lists the 1000 or so products. and then SELECT * FROM DataSheets, it lists the 800 datasheets we...
16
2665
by: cody | last post by:
I have to write an algorithm with must ensure that objects are put in buckets (which are always 4 in size). The objects have two properties: A and B. It is not allowed that in a bucket are objects with the same A or B value. But there can be more than one object with A = null or B = null in the bucket. Sometimes there is only one valid solution, sometimes there are more valid solutions, and sometimes there isn't a complete solution at...
8
19600
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
4
2486
by: algroth | last post by:
Hi! I try to do a nested inner join by sql, but I always get an "Syntax-error in FROM-clause". The statement I try around with is: SELECT * FROM st1 INNER JOIN st2 INNER JOIN st3
8
2009
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the same query at the CLI. I am having trouble executing a large query through my PHP script. It takes about 7-11 seconds on average to execute, whereas the same query only takes 0.01 seconds to execute through the CLI.
9
5759
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just call it Express for simplicity). I have, to try to simplify things, put the exact same DB on two systems, one running MSDE and one running Express. Both have 2 Ghz processors (one Intel, one AMD), both have a decent amount of RAM (Intel system...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.