Solved

Help with query

Posted on 2013-05-31
9
199 Views
Last Modified: 2013-07-06
I have a query
SELECT [1 DairyCrest Master Data V2].[Oracle No], [1 DairyCrest Master Data V2].Group, [1 DairyCrest Master Data V2].[New Description], [1 DairyCrest Master Data V2].[New Long Description], [1 DairyCrest Master Data V2].Manufacturer, [1 DairyCrest Master Data V2].[Manufacturers Item No], [1 DairyCrest Master Data V2].Noun, [1 DairyCrest Master Data V2].Attribute1, [1 DairyCrest Master Data V2].Attribute2, [1 DairyCrest Master Data V2].Attribute3, [1 DairyCrest Master Data V2].Attribute4, [1 DairyCrest Master Data V2].Attribute5, [1 DairyCrest Master Data V2].Attribute6, [1 DairyCrest Master Data V2].Attribute7, [1 DairyCrest Master Data V2].Attribute8, [1 DairyCrest Master Data V2].Attribute9, [1 DairyCrest Master Data V2].[Old Description]
FROM [1 DairyCrest Master Data V2]
WHERE ((([1 DairyCrest Master Data V2].[Oracle No]) In (SELECT [Oracle No] FROM [1 DairyCrest Master Data V2] As Tmp GROUP BY [Oracle No] HAVING Count(*)>1 )))
ORDER BY [1 DairyCrest Master Data V2].[Oracle No];

I would like to see only the records where the New Decription field is not the same

What criteria do I need to add to the New Decription column

Gordon
0
Comment
Question by:GiaHughes
  • 5
  • 3
9 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 39211027
How about :

Select  [1 DairyCrest Master Data V2].[New Description], Count ( [1 DairyCrest Master Data V2].[New Description]) FROM [1 DairyCrest Master Data V2] group by [1 DairyCrest Master Data V2].[New Description]

that will show you ALL the New Desctiption values and how many of each there are

AW
0
 

Author Comment

by:GiaHughes
ID: 39211890
Hi

I am looking to see only the records where the description is different so that I can amend the description to be the same for each unique oracle number

Gordon
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 39211999
What do you mean by "different" - that could mean comparing the first record with the last record, for example.

Can you show an example of what you want to accomplish?

AW
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:GiaHughes
ID: 39212070
Hi AW

Ok
Oracle no 1234567 may appear 2 or more times in the db
If the descriptions are all the same I do not want to see these records

But if it has different new descriptions for example
Test
Test2
Test3

I want to see these records so that I could change them all to read Test as an example

The current query only looks at where the oracle number is duplicated and I have to look at 3000 records manually to see if the descriptions are different

Hope this explanation is ok

Gordon
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 39212122
but you would seem to allow the possibility that there could be 4 records, but two different values for New Description:

Test
Test1
Test
Test1

what would you do then?

AW
0
 

Author Comment

by:GiaHughes
ID: 39212525
Hi AW

I would want to see this
Only want to not see where all the new descriptions are the same
This is so that I can modify the descriptions to be the same for an oracle number

Gordon
0
 
LVL 40

Expert Comment

by:Sharath
ID: 39218065
Can you try this?
SELECT [1 DairyCrest Master Data V2].[Oracle No], 
       [1 DairyCrest Master Data V2].Group, 
       [1 DairyCrest Master Data V2].[New Description], 
       [1 DairyCrest Master Data V2].[New Long Description], 
       [1 DairyCrest Master Data V2].Manufacturer, 
       [1 DairyCrest Master Data V2].[Manufacturers Item No], 
       [1 DairyCrest Master Data V2].Noun, 
       [1 DairyCrest Master Data V2].Attribute1, 
       [1 DairyCrest Master Data V2].Attribute2, 
       [1 DairyCrest Master Data V2].Attribute3, 
       [1 DairyCrest Master Data V2].Attribute4, 
       [1 DairyCrest Master Data V2].Attribute5, 
       [1 DairyCrest Master Data V2].Attribute6, 
       [1 DairyCrest Master Data V2].Attribute7, 
       [1 DairyCrest Master Data V2].Attribute8, 
       [1 DairyCrest Master Data V2].Attribute9, 
       [1 DairyCrest Master Data V2].[Old Description] 
  FROM [1 DairyCrest Master Data V2] 
 WHERE [1 DairyCrest Master Data V2].[Oracle No] IN (SELECT [Oracle No] 
                                                       FROM (SELECT DISTINCT [Oracle No], 
                                                                             [New Description]
                                                               FROM [1 DairyCrest Master Data V2]) AS T1
                                                      GROUP BY [Oracle No], 
                                                               [New Description] 
                                                     HAVING COUNT(*) > 1) 
 ORDER BY [1 DairyCrest Master Data V2].[Oracle No]; 

Open in new window

0
 

Accepted Solution

by:
GiaHughes earned 0 total points
ID: 39290316
Cannot get any of these solutions to work
0
 

Author Closing Comment

by:GiaHughes
ID: 39303684
Doing it manually
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question