Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    15

    Arrow Unanswered: query for multiple tables

    In my Table 1 I created a query to group the field 'TagName' with the same name.Heres my codes


    Dim qdf=DAO.Querydef

    Set qdf = CurrentDb.QueryDefs("MyQuery")

    qdf.SQL = "SELECT TagName , COUNT(TagName) AS Total FROM Table1 GROUP by TagName ORDER BY " & COUNT(TagName)

    Now I want the query to display the result of mutiple table (Table 1 , Table 2 , Table 3 ..........).Is it any easy,fast and efficient way to do it? Or the table must be combine first?

  2. #2
    Join Date
    Apr 2004
    Posts
    15

    Re: query for multiple tables

    Originally posted by koesk
    In my Table 1 I created a query to group the field 'TagName' with the same name.Heres my codes


    Dim qdf=DAO.Querydef

    Set qdf = CurrentDb.QueryDefs("MyQuery")

    qdf.SQL = "SELECT TagName , COUNT(TagName) AS Total FROM Table1 GROUP by TagName ORDER BY " & COUNT(TagName)

    Now I want the query to display the result of mutiple table (Table 1 , Table 2 , Table 3 ..........).Is it any easy,fast and efficient way to do it? Or the table must be combine first?

    I've tried this statement

    SELECT Tagname
    FROM 040320al;
    UNION ALL SELECT Tagname
    FROM 040321al;
    UNION ALL SELECT Tagname
    FROM 040322al
    GROUP BY TagName
    ORDER BY TagName;

    It works fine but I was unable to put ' COUNT(TagName) AS Total '.Is it anyway for doing this?

Posting Permissions

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