Sign Up |  Live StatsLive Stats    Articles 35,345| Comments 159,790| Members 17,820, Newest waheguruhelpme| Online 208
Home Contact
 (Forgotten?): 
    Sikhism

   
                                                                     Your Banner Here!    

Sikh Philosophy Network » Sikh Philosophy Network » Current Affairs » Information Technology » Why? 'Not equal' brings back whats 'equal'

Why? 'Not equal' brings back whats 'equal'

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 400 USD, Received: 35 USD (9%)
Please Donate...
Related Topics...
Thread Thread Starter Forum Replies Last Post
All Religions will NEVER be equal Sikh News Reporter Sikh News 0 21-Feb-2011 09:30 AM
Why Religion Does not Equal War Narayanjot Kaur Interfaith Dialogues 1 02-Aug-2010 19:33 PM
No One is Equal To the Guru-Gurbani Pyramid Gurmat Vichaar 10 27-Mar-2008 00:05 AM
Are We All Born Equal? Neutral Singh Spiritual Articles 6 15-Nov-2005 22:33 PM


Tags
back, brings, equal
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:38 AM
Gina's Avatar Gina
Guest
 
Posts: n/a
   
   
Why? 'Not equal' brings back whats 'equal'

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I am comparing two fields (the same) in two tables. If the first field
matches in both tables and the second field does not match I want it to
append from the first table to the second table.


In a query ... two tables ... two fields that are identical in both tables.
'Acct #' and 'Closure Date'

In the 'Closure Date' field under Criteria I have the following...

<>([History Table ALL].[Closure Date])

This is what is in the First Table
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/13554-why-not-equal-brings-back-whats.html

1 06-05-06
255 06-05-06
255 06-20-06

This is what is in the Second Table (that I am comparing the First Table with)

1 06-05-06
255 06-05-06
255 06-20-06
255 06-20-06
255 06-20-06
255 06-20-06

After running the query I get back the result of 255 06-20-06
This is obviously in the second table, so why does it keep returning this
value.



The following is the complete sql script.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554

INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason Code #],
Exclude, Notes, [Closure Type] )
SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date], [ccInput
Table].[Reason Code #], [ccInput Table].Exclude, [ccInput Table].Notes,
[ccInput Table].[Closure Type]
FROM [ccInput Table] LEFT JOIN [History Table ALL] ON [ccInput Table].[Acct
#] = [History Table ALL].[Acct #]
WHERE ((([ccInput Table].[Closure Date])<>([History Table ALL].[Closure
Date])))
ORDER BY [ccInput Table].[Acct #];

Hope I have given you adequate information. If not, let me know.

Thank you.
--
Gina





 
Do share your immediate thoughts or reactions on this issue? We value your views! Login Now! or Sign Up Today! to share your views with us.. Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:38 AM
Sylvain Lafontaine's Avatar Sylvain Lafontaine
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

If you print the selection for the Accnt# and the ClosureDate for *both*
tables when they are Left Jointed, you will easily see where your error is
coming from.

In your case, I would suggest that you use instead the Not Exists (...)
clause; as it's far more easier to use (and understand) for writing this
type of queries.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554


"Gina" wrote in message
news:09936ED7-5748-424B-9C0E-653590B2F554@microsoft.com...
>I am comparing two fields (the same) in two tables. If the first field
> matches in both tables and the second field does not match I want it to
> append from the first table to the second table.
>
>
> In a query ... two tables ... two fields that are identical in both
> tables.
> 'Acct #' and 'Closure Date'
>
> In the 'Closure Date' field under Criteria I have the following...
>
> <>([History Table ALL].[Closure Date])
>
> This is what is in the First Table
>
> 1 06-05-06
> 255 06-05-06
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
> 255 06-20-06
>
> This is what is in the Second Table (that I am comparing the First Table
> with)
>
> 1 06-05-06
> 255 06-05-06
> 255 06-20-06
> 255 06-20-06
> 255 06-20-06
> 255 06-20-06
>
> After running the query I get back the result of 255 06-20-06
> This is obviously in the second table, so why does it keep returning this
> value.
>
>
>
> The following is the complete sql script.
>
> INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason Code
> #],
> Exclude, Notes, [Closure Type] )
> SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date], [ccInput
> Table].[Reason Code #], [ccInput Table].Exclude, [ccInput Table].Notes,
> [ccInput Table].[Closure Type]
> FROM [ccInput Table] LEFT JOIN [History Table ALL] ON [ccInput
> Table].[Acct
> #] = [History Table ALL].[Acct #]
> WHERE ((([ccInput Table].[Closure Date])<>([History Table ALL].[Closure
> Date])))
> ORDER BY [ccInput Table].[Acct #];
>
> Hope I have given you adequate information. If not, let me know.
>
> Thank you.
> --
> Gina



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:38 AM
Gina's Avatar Gina
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

I have tried 'Not' 'Not In' and '<>' they all give me the same results.

I am not sure what you are trying to tell me when you say to print the
selection for the Acct # and Closure Date.

However, with more trial and error, I am starting to think that in the
'DATE/TIME' format of the 'Closure Date' - that the query is recognizing a
time and therefore sees it as being different and not the same. Is this
possible? If so, how do I tell Access not to acknowledge the time and only
the date?
--
Gina


"Sylvain Lafontaine" wrote:

> If you print the selection for the Accnt# and the ClosureDate for *both*
> tables when they are Left Jointed, you will easily see where your error is
> coming from.
>
> In your case, I would suggest that you use instead the Not Exists (...)
> clause; as it's far more easier to use (and understand) for writing this
> type of queries.
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: http://cerbermail.com/?QugbLEWINF
>
>
> "Gina" wrote in message
> news:09936ED7-5748-424B-9C0E-653590B2F554@microsoft.com...
> >I am comparing two fields (the same) in two tables. If the first field
> > matches in both tables and the second field does not match I want it to
> > append from the first table to the second table.
> >
> >
> > In a query ... two tables ... two fields that are identical in both
> > tables.
> > 'Acct #' and 'Closure Date'
> >
> > In the 'Closure Date' field under Criteria I have the following...
> >
> > <>([History Table ALL].[Closure Date])
> >
> > This is what is in the First Table
> >
> > 1 06-05-06
> > 255 06-05-06
> > 255 06-20-06
> >
> > This is what is in the Second Table (that I am comparing the First Table
> > with)
> >
> > 1 06-05-06
> > 255 06-05-06
> > 255 06-20-06
> > 255 06-20-06
> > 255 06-20-06
> > 255 06-20-06
> >
> > After running the query I get back the result of 255 06-20-06
> > This is obviously in the second table, so why does it keep returning this
> > value.
> >
> >
> >
> > The following is the complete sql script.
> >
> > INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason Code
> > #],
> > Exclude, Notes, [Closure Type] )
> > SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date], [ccInput
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
> > Table].[Reason Code #], [ccInput Table].Exclude, [ccInput Table].Notes,
> > [ccInput Table].[Closure Type]
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
> > FROM [ccInput Table] LEFT JOIN [History Table ALL] ON [ccInput
> > Table].[Acct
> > #] = [History Table ALL].[Acct #]
> > WHERE ((([ccInput Table].[Closure Date])<>([History Table ALL].[Closure
> > Date])))
> > ORDER BY [ccInput Table].[Acct #];
> >
> > Hope I have given you adequate information. If not, let me know.
> >
> > Thank you.
> > --
> > Gina

>
>
>

Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:38 AM
Sylvain Lafontaine's Avatar Sylvain Lafontaine
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

If you make a Select query and display the result from both tables, you will
see something like:

#1 Date1 #2 Date2
.....
255 06-05-06 255 06-05-06
255 06-05-06 255 06-20-06
.....
255 06-20-06 255 06-05-06
255 06-20-06 255 06-20-06
.....

Notice that on the second and third lines, the date from the first table is
different from the date of the second date, hence these values will get
inserted again because of your test « Where date1 <> date2 ».

Instead of a Left Join, you could use something like:

Insert ...
Select ...
From [ccInput Table] as I
Where Not Exists (Select * From [History Table ALL] as H where I.[Acct #] =
H.[Acct #] and I.[Closure Date] = H.[Closure Date])

It's possible to tweak the Left Join in order to have the result that you
want but it's a little more complicated then that.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"Gina" wrote in message
news:52579EA1-63FC-43EE-9BFF-308C48F469BE@microsoft.com...
>I have tried 'Not' 'Not In' and '<>' they all give me the same results.
>
> I am not sure what you are trying to tell me when you say to print the
> selection for the Acct # and Closure Date.
>
> However, with more trial and error, I am starting to think that in the
> 'DATE/TIME' format of the 'Closure Date' - that the query is recognizing a
> time and therefore sees it as being different and not the same. Is this
> possible? If so, how do I tell Access not to acknowledge the time and
> only
> the date?
> --
> Gina
>
>
> "Sylvain Lafontaine" wrote:
>
>> If you print the selection for the Accnt# and the ClosureDate for *both*
>> tables when they are Left Jointed, you will easily see where your error
>> is
>> coming from.
>>
>> In your case, I would suggest that you use instead the Not Exists (...)
>> clause; as it's far more easier to use (and understand) for writing this
>> type of queries.
>>
>> --
>> Sylvain Lafontaine, ing.
>> MVP - Technologies Virtual-PC
>> E-mail: http://cerbermail.com/?QugbLEWINF
>>
>>
>> "Gina" wrote in message
>> news:09936ED7-5748-424B-9C0E-653590B2F554@microsoft.com...
>> >I am comparing two fields (the same) in two tables. If the first field
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
>> > matches in both tables and the second field does not match I want it to
>> > append from the first table to the second table.
>> >
>> >
>> > In a query ... two tables ... two fields that are identical in both
>> > tables.
>> > 'Acct #' and 'Closure Date'
>> >
>> > In the 'Closure Date' field under Criteria I have the following...
>> >
>> > <>([History Table ALL].[Closure Date])
>> >
>> > This is what is in the First Table
>> >
>> > 1 06-05-06
>> > 255 06-05-06
>> > 255 06-20-06
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
>> >
>> > This is what is in the Second Table (that I am comparing the First
>> > Table
>> > with)
>> >
>> > 1 06-05-06
>> > 255 06-05-06
>> > 255 06-20-06
>> > 255 06-20-06
>> > 255 06-20-06
>> > 255 06-20-06
>> >
>> > After running the query I get back the result of 255
>> > 06-20-06
>> > This is obviously in the second table, so why does it keep returning
>> > this
>> > value.
>> >
>> >
>> >
>> > The following is the complete sql script.
>> >
>> > INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason
>> > Code
>> > #],
>> > Exclude, Notes, [Closure Type] )
>> > SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date],
>> > [ccInput
>> > Table].[Reason Code #], [ccInput Table].Exclude, [ccInput Table].Notes,
>> > [ccInput Table].[Closure Type]
>> > FROM [ccInput Table] LEFT JOIN [History Table ALL] ON [ccInput
>> > Table].[Acct
>> > #] = [History Table ALL].[Acct #]
>> > WHERE ((([ccInput Table].[Closure Date])<>([History Table ALL].[Closure
>> > Date])))
>> > ORDER BY [ccInput Table].[Acct #];
>> >
>> > Hope I have given you adequate information. If not, let me know.
>> >
>> > Thank you.
>> > --
>> > Gina

>>
>>
>>



Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:38 AM
John Vinson's Avatar John Vinson
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

On Wed, 19 Jul 2006 1101 -0700, Gina
wrote:

>After running the query I get back the result of 255 06-20-06
>This is obviously in the second table, so why does it keep returning this
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
>value.


Just to explain the logic... which makes sense when you understand it
but isn't immediately obvious!

INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason
Code #], Exclude, Notes, [Closure Type] )
SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date],
[ccInput Table].[Reason Code #], [ccInput Table].Exclude, [ccInput
Table].Notes, [ccInput Table].[Closure Type]
FROM [ccInput Table]
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
LEFT JOIN [History Table ALL]
ON [ccInput Table].[Acct #] = [History Table ALL].[Acct #]
WHERE ((([ccInput Table].[Closure Date])<>([History Table
ALL].[Closure Date])))
ORDER BY [ccInput Table].[Acct #];

What this is doing is joining [ccInput Table] to [History Table ALL].
Every [Acct #] in [ccInput Table] is linked to the corresponding
records with the same [Acct #] in [History Table ALL], in *all
possible combinations*. If there are ten records for a given Acct # in
[ccInput Table] and twenty for that Acct # in [History Table ALL],
you'll get all 200 possible combinations.

If the Closure Date in any one of these is different from the closure
date in the History table, that record gets retrieved. It doesn't
matter a bit if there are OTHERE records where the dates are equal -
if it finds one inequality, that's good enough.

John W. Vinson[MVP]
Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:38 AM
Gina's Avatar Gina
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

Thank you both for your assistance. Below is what I found to work. I needed
to join both the Acct# and the also Join the Closure Date fields and then use
Is Null for the History Table ALL.Closure Date.

John, Thank you for the extra explaination, it did help to put it in
perspective. I was expecting a different result than what I was obviously
querying.

Again, thank you both for your time.

Gina


INSERT INTO [History Table ALL] ( [Acct #], [Closure Date] )
SELECT DISTINCTROW [ccInput Table].[Acct #], [ccInput Table].[Closure Date]
FROM [ccInput Table] LEFT JOIN [History Table ALL] ON ([ccInput Table].[Acct
#] = [History Table ALL].[Acct #]) AND ([ccInput Table].[Closure Date] =
[History Table ALL].[Closure Date])
WHERE ((([History Table ALL].[Closure Date]) Is Null))
ORDER BY [ccInput Table].[Acct #]
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
WITH OWNERACCESS OPTION;

--
Gina


"John Vinson" wrote:

> On Wed, 19 Jul 2006 1101 -0700, Gina
> wrote:
>
> >After running the query I get back the result of 255 06-20-06
> >This is obviously in the second table, so why does it keep returning this
> >value.

>
> Just to explain the logic... which makes sense when you understand it
> but isn't immediately obvious!
>
> INSERT INTO [History Table ALL] ( [Acct #], [Closure Date], [Reason
> Code #], Exclude, Notes, [Closure Type] )
> SELECT [ccInput Table].[Acct #], [ccInput Table].[Closure Date],
> [ccInput Table].[Reason Code #], [ccInput Table].Exclude, [ccInput
> Table].Notes, [ccInput Table].[Closure Type]
> FROM [ccInput Table]
> LEFT JOIN [History Table ALL]
> ON [ccInput Table].[Acct #] = [History Table ALL].[Acct #]
> WHERE ((([ccInput Table].[Closure Date])<>([History Table
> ALL].[Closure Date])))
> ORDER BY [ccInput Table].[Acct #];
>
> What this is doing is joining [ccInput Table] to [History Table ALL].
> Every [Acct #] in [ccInput Table] is linked to the corresponding
> records with the same [Acct #] in [History Table ALL], in *all
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
> possible combinations*. If there are ten records for a given Acct # in
> [ccInput Table] and twenty for that Acct # in [History Table ALL],
> you'll get all 200 possible combinations.
>
> If the Closure Date in any one of these is different from the closure
> date in the History table, that record gets retrieved. It doesn't
> matter a bit if there are OTHERE records where the dates are equal -
> if it finds one inequality, that's good enough.
>
> John W. Vinson[MVP]
>

Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:38 AM
John Vinson's Avatar John Vinson
Guest
 
Posts: n/a
   
   
Re: Why? 'Not equal' brings back whats 'equal'

  Donate Today!  
On Thu, 20 Jul 2006 09:50:02 -0700, Gina
wrote:

>Thank you both for your assistance. Below is what I found to work. I needed
>to join both the Acct# and the also Join the Closure Date fields and then use
>Is Null for the History Table ALL.Closure Date.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554
>


ah... a "frustrated outer join" query is what I call that. I was
guessing that was your desired result but wasn't certain.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13554

John W. Vinson[MVP]
Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Gurbani Jukebox
Listen to Gurbani while surfing SPN!
» Active Discussions
sikhism Who is "Mohan"?
Today 08:46 AM
22 Replies, 335 Views
sikhism How important is Matha...
Today 08:12 AM
59 Replies, 1,038 Views
sikhism need urgent advice.......
Today 06:46 AM
6 Replies, 81 Views
sikhism ਨਾਮਾ
Today 06:37 AM
2 Replies, 53 Views
sikhism Sikh Diamonds Video...
Today 04:23 AM
6 Replies, 116 Views
sikhism Are Creator and Creation...
Today 01:30 AM
44 Replies, 2,837 Views
sikhism Herman Hesse,...
Today 00:54 AM
13 Replies, 229 Views
sikhism On a Scale of Most...
Yesterday 21:42 PM
30 Replies, 1,277 Views
sikhism I became victim by...
Yesterday 19:50 PM
0 Replies, 44 Views
sikhism Sikh Books downloads
Yesterday 15:39 PM
2 Replies, 66 Views
sikhism Salok Sheikh Farid ji...
Yesterday 09:35 AM
0 Replies, 47 Views
sikhism In Punjab, three farmers...
Yesterday 05:36 AM
0 Replies, 49 Views
sikhism Supernatural Sikhs, what...
Yesterday 03:45 AM
19 Replies, 414 Views
sikhism Sukhmani Sahib Astpadi...
26-May-2012 22:57 PM
0 Replies, 51 Views
Do You Think You Are...
26-May-2012 09:59 AM
94 Replies, 8,258 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.2

All times are GMT +6.5. The time now is 09:32 AM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 1.03526 seconds with 30 queries