|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
September 6th, 2005, 07:28 AM
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Distinct values of data
Hi everyone,
I need help in finding distinct values of data from a table. I have a table that has 3 columns or fields memName1,memName2,memName3 which contains multiple names separated by ",".I now want to obtain the distinct names that appear in these columns into one single column.
I am not able to construct a proper sql query. Can anyone help me with this??
Thanks in advance
|
September 6th, 2005, 07:37 AM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What do you mean? Do you want to concatenate the columns like "memName1, memName2, memName3" or do you want to split out the date like this:
FROM:
memName1
FirstData, SecondData, thirdData
TO:
NewColumn
FirstData
SecondData
ThirdData
etc.
mmcdonal
|
September 6th, 2005, 07:38 AM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Sorry, split out the data, not the date.
mmcdonal
|
September 6th, 2005, 07:43 AM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Or, like this...
FROM:
memName1
FirstData, SecondData, thirdData
TO:
New Column1 NewColumn2 NewColumn3
FirstData SecondData ThirdData
mmcdonal
|
September 6th, 2005, 07:47 AM
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
First of all I want concatenate the values in memName1,memName2,memName3 then when I get a composite value I want to obtain the distinct names in to another column or variable.
from:
memName1,memName2,memName3
to
New Column
|
September 6th, 2005, 09:28 AM
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What is the starting format, and the ending format? Please use sample data.
mmcdonal
|
September 8th, 2005, 02:22 AM
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well I am giving some sample data as below:
memName1:
Shekhar Mehta
Aniruddh Daga
Aniruddh Daga, Nisheeth Totla
Virendra Singhvi
Raakesh Jain
Pradeep Tibrewal
memName2:
Naresh Kumar Jalan
Shekhar Mehta
Shekhar Mehta
Raj Somani
Sunil Poddar
memName3:
Vinay Agarwal
Deepak Choudhary, Raghupati Bhuwalka
Sanjay Bagaria
Raghupati Bhuwalka, Ramesh Khaitan
Nathmal Neotia, Ram Pal Widhawan, S Chiraniwala
Mahesh Shah, Padam Agarwal, Sanjay Bagaria
Sunil Poddar
I need a query which will return me the distinct names only into one column or as one single dataset that appear in the 3 columns memName1,memName2,memName3.
the columns memName1,memName2,memName3 are text fields and the return column also has to be a text field.
It will be great if such a query can be constructed.
Thanks
|
September 8th, 2005, 02:37 AM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
So, using the first value in each field, your new column should look like:
Shekhar, Mehta Naresh Kumar Jalan, Vinay Agarwal
Is this correct?
Kevin
dartcoach
|
September 8th, 2005, 02:42 AM
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My new column should have each single name as a single row value and names will not be separated by commas and not repeated i.e distinct rows only
|
September 8th, 2005, 02:45 AM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Could you give me an example of what you want the data to look like?
Kevin
dartcoach
|
|
|