Hello,
I have been trying to work on a query to return the amount of entries
that are not in each hour. There is a problem with the syncronisation
between our databases and I want to find a pattern, in the hours or in
the tags on what is not syncronising. In one DB (primary) I have the
full 6000 records, per hour, over the span of a weekend the backup
site was short about 200 records.
An example of the tables is
TableA TableB
tagId tagName tagId
gmt_time(hourly)
PK composite PK
approx 6000 records approx 6000 every hour
So essentially I would like to see if anyone would know a query that
would group by the hours and return which tags were not present in
that hour.
Thank you in advance for any help.
Andy McDonaghselect tagid, datepart(d, gmt_time) as dy, datepart(hh, gmt_time) as hr
from tablea a (nolock)
where not exists (select * from tableb b (nolock) where a.tagid = b.tagid)
group by datepart(d, gmt_time), datepart(hh, gmt_time)
TheSQLGuru
President
Indicium Resources, Inc.
<mcdonaghandy@.gmail.com> wrote in message
news:1184775962.160779.8450@.x35g2000prf.googlegroups.com...
> Hello,
> I have been trying to work on a query to return the amount of entries
> that are not in each hour. There is a problem with the syncronisation
> between our databases and I want to find a pattern, in the hours or in
> the tags on what is not syncronising. In one DB (primary) I have the
> full 6000 records, per hour, over the span of a weekend the backup
> site was short about 200 records.
> An example of the tables is
> TableA TableB
> tagId tagName tagId
> gmt_time(hourly)
> PK composite PK
> approx 6000 records approx 6000 every hour
> So essentially I would like to see if anyone would know a query that
> would group by the hours and return which tags were not present in
> that hour.
> Thank you in advance for any help.
> Andy McDonagh
>
No comments:
Post a Comment