Question : Access - Select Distinct on Multiple Fields

Hi,

Table A contains the following for ID and Value

ID                               Value
1                               Apples
2                               Oranges
3                                Grapes

Table B contains the following for fields ID, Value, and Color

ID                                Fruit                         Color
10                              Apples                     Blue
20                             Oranges                    Green
30                             Grapes                      Yellow

I would like to update Color into Table A (based on Table B). However, when I create an Inner Join on ID and Value, and output ID from A, I get the following:

ID                  Color      Fruit
1                   Blue       Apples
1                   Green    Oranges
1                   Yellow   Grapes
2                   Blue       Apples
2                    Green   Oranges
2                    Yellow  Grapes
3                    Blue      Apples
3                    Green    Oranges
3                     Yellow  Grapes


What I would like to see is

ID                           Color                      Fruit
1                              Blue                    Apples
2                              Green                 Oranges
3                             Yellow                 Grapes

Your assistance is appreciated. I have tried Select Distinct and Group By, no luck.

Thanks.

Answer : Access - Select Distinct on Multiple Fields

I'm not sure I understand what you want to do.
Listing content by tags or other data is clearly work for Views.
If you want to alter the content somehow, take a look at "Views bulk operations", which helps you "do things" to the nodes listed by a view.

If you really need to access CCK data in code then I suggest you read this blog:
http://www.drewish.com/content/2010/06/correctly_accessing_cck_fields_in_sql_queries
which will give you some info on "doing it right" and an example.
Random Solutions  
 
programming4us programming4us