Link to home
Start Free TrialLog in
Avatar of Derek Brown
Derek BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Query Problem

I have a query that has 10 columns with 10 rows/records. 9 of the columns have the same data in each record, one column has item numbers which are all different. What I want is one row showing a quantity of 10, (one for each record) and all of the item numbers from the 10 records concatenated into a new column or Note field.

There are good reasons for doing this. So I won't bother you with them. Suffice to say that there could be 100 records with only 2 or 3 variations but 100 item numbers.

A simpler way to look at it (I guess) is one column of 10 item numbers concatenated into one record In the query, if that is possible
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try something like this

select itemnumber, [col1] & "-"  & [col2]  & "-"  & [col3] & "-"  & [col4]  & "-"  & [col5] & "-"  & [col6] & "-"  & [col7] & "-"  & [col8] & "-"  & [col9] As NewCol, count([itemnumber]) as Qty
from tableName
group By [itemnumber], [col1] & "-"  & [col2]  & "-"  & [col3] & "-"  & [col4]  & "-"  & [col5] & "-"  & [col6] & "-"  & [col7] & "-"  & [col8] & "-"  & [col9]
Avatar of Derek Brown

ASKER

Hi Als315

Could you please send sample db as MDB file I am still on 2002.

Thank you.
Derek
@Derek,

did you try the query posted above?
SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you type a sample of few records, and list the expected output?
Hi Ray Als315

It's not the columns that I want to concatenate it is the rows of one column into one field. Will your code do that?

Please see attached MDB. Ignore SetsConcatenated Table, that was created just to demonstrate Query 2. Query1 is what I am working with but I want the result to look like query2

Derek
db1.mdb
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do it with DConcat, which is universal for all cases
DBConcat.mdb
Thank you both. Excellent resolution

Derek