Results 1 to 7 of 7
  1. #1
    melanie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    4

    LIKE '* [expression] '

    hi i need something like this:

    SELECT row1, row2, row3


    FROM table
    WHERE row3 LIKE '*[row2-row1]'

    can you help me please?

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Does Row1, Row2 represent field names or are you trying to only bring certain records into the query. This is not very clear as to what you are attempting. Perhaps an example of what you have and what the end result should look like would help us to give you a viable answer. Use some values so it will be clear to us what your objectives are.

  3. #3
    melanie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    4
    im sorry i was a bit tired when I wrote it.. by 'row' i meant column.. ie field.

    i need to subtract the values from 2 fields (EndYear - StartYear) and check that the value in another field ends with that answer

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Is this what you are attempting to do?

    Code:
    SELECT Table7.StartYear, Table7.EndYear, Table7.CalcYear, [EndYear]-[StartYear] AS Difference, IIf([Difference]=[CalcYear],"Yes","No") AS Same
    FROM Table7;

  5. #5
    melanie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    4
    Here is exactly what I have:
    a db containing info about the tv series i have on my pc. 3 of the fields are:
    - Start Year: when the series started showing
    - End Year: when the series ended (null if its still showing)
    - Seasons: the seasons i have

    Example: Friends 1994 2004 1-10

    now i want to know which seasons i have missing, so from the example above i need to check 2004-1994 (10) and check that the 'Seasons' fields ends with '10' (ie '*10')

    i tried something like this:

    SELECT *
    FROM Series
    WHERE (Seasons Not Like '1*')
    OR (Seasons Not Like '*' & Val([End Year])-Val([Start Year])
    AND [End Year] Is Not Null);

    but im getting a data type mismatch

  6. #6
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Ok. Try this:

    Code:
    SELECT Table7.Program, Table7.StartYear, Table7.EndYear, Table7.Seasons, [EndYear]-[StartYear] AS Tenure, Mid([Seasons],3) AS [Last], [Tenure]-[Last] AS SeasonsMissing, IIf([Tenure]=[Last],"Have All","Missing" & " " & [SeasonsMissing]) AS Missing
    FROM Table7;

  7. #7
    melanie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    4
    it worked thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Expression Help
    By bboyd in forum Access
    Replies: 3
    Last Post: 11-25-2011, 06:11 AM
  2. Expression
    By jltm8 in forum Access
    Replies: 5
    Last Post: 11-03-2011, 10:09 AM
  3. Looking for help with an expression
    By CoachBarker in forum Queries
    Replies: 3
    Last Post: 11-25-2010, 05:17 AM
  4. Expression value
    By KWarzala in forum Reports
    Replies: 0
    Last Post: 06-15-2010, 12:35 PM
  5. Help With an expression
    By kylem4711 in forum Queries
    Replies: 2
    Last Post: 04-23-2009, 01:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums