#1
  1. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2007
    Posts
    184
    Rep Power
    8

    Where value is like field name


    Hi Guys,

    I'm trying to write a query that looks at a value of a record and returns a value based on the name of the field. Basicly I have a language table that contains the days of the week in a number of diffrent languages, which has field names like DAY1 DAY2 ... DAY7 and another table that has a day field with the value like 1,2...7. What I want to achieve is to look at the name of the field and return its value.

    Does anyone know of a way to do this?

    Many Thanks
    On the off chance that I have been helpfull please click this
  2. #2
  3. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Mar 2006
    Location
    South Wales
    Posts
    3,674
    Rep Power
    2043
    I'm sorry I dont understand what you are trying to achieve. Any chance you could post a sample of your data so we can see what is going on?
  4. #3
  5. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2007
    Posts
    184
    Rep Power
    8
    Yeah it does sound pretty confusing, this is my data structure:

    Language Table:

    | LANG | DAY1 | DAY2 | DAY3 | etc
    | E | Mon | Tue | Wed |

    Store Table:

    | Some Data | Some Data | DAY |
    | DATA | DATA | 1 |

    So in this case I'd want to return the day 1 so the query would need to look at the field names of the language table and return the value where field is day1.

    Does this help?

    Thanks
  6. #4
  7. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2007
    Posts
    184
    Rep Power
    8
    I've wrote a query that describles what I want to do, it doesnt work of course but I've found the SQL keyword COLUMNS that sounds like it does what I want.
    Code:
    SELECT FLAT_CHOVERDAY FROM F_APARTMENTS, F_LANGUAGE WHERE (FLAT_CHOVERDAY LIKE COLUMS FROM F_LANGUAGE) AND (FLAT_CHOVERDAY = 1) ;
    What I want this to do is to return the value in the record of the F_LANGUAGE table where its column name is like that FLAT_CHOVERDAY field.

    Does this help at all?

    Thanks

Similar Threads

  1. Change the Back Color of an Active Field
    By CorrieAnn in forum Microsoft Access Help
    Replies: 7
    Last Post: January 12th, 2005, 11:42 AM
  2. The form, the date field, his asp code, and her database!
    By wheeliecake in forum ASP Development
    Replies: 8
    Last Post: December 24th, 2004, 05:54 AM
  3. assign drop down menu item value to hidden field
    By maxtrixx in forum ASP Development
    Replies: 5
    Last Post: July 22nd, 2004, 01:48 PM
  4. Simple combo box/text box issue, difficult description (part 1)
    By etalent in forum Microsoft Access Help
    Replies: 1
    Last Post: March 29th, 2004, 05:16 PM
  5. Simple combo box/text box issue, difficult description (part 2)
    By etalent in forum Microsoft Access Help
    Replies: 0
    Last Post: March 29th, 2004, 04:15 PM

IMN logo majestic logo threadwatch logo seochat tools logo