Hi there,
I'm stuck here and would appreciate any nudges or ideas! My basic scenario is this - I have a table with duplicate records and I need to take the values from the duplicate records and place them into separate columns. The table structure is similar to this (sorry - periods are being used as separators):
SAMPLE....VALUE
G1234...........50
G1234...........68
What I'm aiming for is something like this (preferably stored in a query):
SAMPLE....VALUE1....VALUE2
G1234............50..............68
I realize that this is not ideal! But this is what the client wants/needs for comparison purposes.
Can this be done via SQL/VBA? I know that I could potentially use an SQL find duplicates query to at least count the duplicates, but that ends up with a count and not the actual values.
Even explaining the logic required would help! I'm using Access 2003 on XPSP2.
Thank you,
Olwyn
3 1387
Hi, Olwyn.
The issue looks to be complicated. So far I don't see how it may be implemented as query, but via temporary table. On the other hand you may easily build a query returning the following results
SAMPLE....VALUE
G1234...........50
G1234...........68
SAMPLE....VALUES_LIST
G1234............50, 68
Would this fit your needs?
Regards,
Fish
Hi Fish!
Yep, it's complicated alright...
I never thought about the concatenation aspect - it *might* work, I'll have to clarify with the client. I suspect it may not be the answer.
My new(?) plan that I'm working on is to load the duplicate samples into an array, then use another array to store the values...much more complicated though...
Cheers,
Olwyn
Hi, Olwyn.
The issue looks to be complicated. So far I don't see how it may be implemented as query, but via temporary table. On the other hand you may easily build a query returning the following results
SAMPLE....VALUE
G1234...........50
G1234...........68
SAMPLE....VALUES_LIST
G1234............50, 68
Would this fit your needs?
Regards,
Fish
If you have no more than two duplicates, you could try something like this:
SELECT SAMPLE, Min(VALUE) AS VALUE1, Max(VALUE) AS VALUE2
FROM YourTable
GROUP BY SAMPLE
HAVING COUNT(*) > 1
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joe Narissi |
last post by:
I have a table, TEST_TABLE, with 6 columns (COL1, COL2, COL3, COL4,
COL5, COL6).... I need to be able to select all columns/rows where
COL3, COL4, and COL5 are unique....
I have tried using...
|
by: Shawn |
last post by:
Hi guys,
I'm trying to compose a query that will select all columns from a
table, but without any duplicates.
E.g.
table name is 'tblShipment'
columns are:
fldUnique(pk) | fldShipNo |...
|
by: kjaggi |
last post by:
I am trying to either write a trigger or a check constraint to prevent
duplicates in my table. There are two columns I need to look at for the
duplicates and only one combo value for both columns...
|
by: bellefy |
last post by:
Hi All,
I have a fairly large table with approx 30K rows that updates every
night via a cron script that automatically downloads the 2 new csv's.
The problem is the files are downloaded from...
|
by: tyrfboard |
last post by:
I've been searching for awhile now on how to remove duplicates from a
table within an Access db and have found plenty of articles on finding
or deleting duplicates. All I want to do is remove them...
|
by: Mark |
last post by:
Let's say I have a table of users, and each user has a list of
categories. I could store each user's categories as TEXT with
delimeters like "cat1|cat2|cat3"
But then I need to be able to get a...
|
by: yin_n_yang74 |
last post by:
I am new to SQL and SQL Server world. There must be a simple solution
to this, but I'm not seeing it. I am trying to create a crystal
report (v8.5) using a stored procedure from SQL Server...
|
by: staja84f |
last post by:
I'm trying to locate duplicate data in a table using 4 columns:
employee_id (primary key), employeeid, lastname and firstname.
I can pull up the duplicate data with the last three listed columns,...
|
by: KimmyG |
last post by:
I'm just starting to use SQL and am much more experienced in Access.
Here is what I do in Access
Copy a table and rename the new table "copytable" also select structure only.
Open "copytable"...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
| |