Query on Change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a table with two columns where the value may have changed and may not
have changed - for example Group 5 to Group 10. I want to query so that I
bring back everything that has changed, but I am bringing back the changed
and those that are still the same value. So, I am bringing back records that
were 5 and are still 5.

How can I write to include every change but not to bring back the queried
number??
 
Let me make sure I understand this, the two columns you reference store the
previous and current values, and you want to return the records where the
Previous_Value and Current_Values are different. This depends on what is in
the Previous_Value column if the data has not changed; I'll assume that the
Previous_Value column is NULL if the value has never changed.

SELECT * FROM yourTable
WHERE ISNULL([Previous_Value]) = False
AND [Previous_Value] <> [Current_Value]

HTH
Dale
 
Dale Fye said:
Let me make sure I understand this, the two columns you reference store the
previous and current values, and you want to return the records where the
Previous_Value and Current_Values are different. This depends on what is in
the Previous_Value column if the data has not changed; I'll assume that the
Previous_Value column is NULL if the value has never changed.

Like 2006 is 5 and 2007 is 10. There are no blanks because I sort by a
different column "Yes" which means they are active in 2007.
SELECT * FROM yourTable
WHERE ISNULL([Previous_Value]) = False
AND [Previous_Value] <> [Current_Value]

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.


Novice2000 said:
Hi,

I have a table with two columns where the value may have changed and may not
have changed - for example Group 5 to Group 10. I want to query so that I
bring back everything that has changed, but I am bringing back the changed
and those that are still the same value. So, I am bringing back records that
were 5 and are still 5.

How can I write to include every change but not to bring back the queried
number??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top