Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    9

    Question Unanswered: Last and Max Query

    I have a table that has these three fields, FILENO, CODE, TRANS_DATE. There is no primary field set but FILENO is the main field. I'm using the following query to find the last code that begins with "S" (along with other conditions) with the latest date.

    Code:
    SELECT A.FILENO, LAST(A.CODE) AS SCODE, MAX(A.TRANS_DATE) AS L_DATE
    FROM dbo_ACTIVE AS A
    WHERE A.CODE Like "S*" And A.CODE Not Like "SCAN*" And A.CODE NOT LIKE "SACORT"
    GROUP BY A.FILENO;
    That works fine. I am however trying to use Excel to link to this query but it will not show any of the records. Any reason why?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. Is there any reason why you use an alias ("AS A") for the table dbo_ACTIVE in the query?

    2. What's the datasource (where is the table dbo_ACTIVE stored)? It looks like an Access attached table with the original table residing on a SQL server.

    3. Where is this query stored (if it is stored at all) and how do you "link" it to Excel (or how do you "link" Excel to it)?
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •