Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    2

    Join Expression Not Supported

    I have a very simple SQL statement but Access cannot process it. Any ideas on how I can do it differently?



    This is the SQL (manually typed since copy and paste doesn't work in this forum):


    SELECT left_value,count(right_value) FROM
    LeftTable LEFT JOIN RightTable
    on left_value = right_value
    GROUP BY left_value

    Database definition:

    LeftTable contains 1 column called left_value
    RightTable contains 1 column called right_value

    Data in LeftTable:
    0
    1
    -1
    .6667

    Data in RightTable:
    0
    1

    Desired Result (it won't display here quite right, but you get the idea)
    Code:
    left_value   count
    =======   =====
    0                  1
    1                  1
    -1                 0
    .6667            0

  2. #2
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    try this:

    SELECT LeftTable.left_value, Count(RightTable.right_value) AS CountOfright_value
    FROM LeftTable LEFT JOIN RightTable ON LeftTable.left_value = RightTable.right_value
    GROUP BY LeftTable.left_value;

    study the difference. good luck.

  3. #3
    Join Date
    Apr 2009
    Posts
    2
    Quote Originally Posted by marianne View Post
    try this:

    SELECT LeftTable.left_value, Count(RightTable.right_value) AS CountOfright_value
    FROM LeftTable LEFT JOIN RightTable ON LeftTable.left_value = RightTable.right_value
    GROUP BY LeftTable.left_value;

    study the difference. good luck.
    That runs better than before, but still it doesn't count the 0 values. It just shows a count of 0 for 0 but should show a count of 1.

  4. #4
    tinytree is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2009
    Posts
    28
    try this:
    SELECT a.left_value, Count(a.right_value) AS CountOfright_value
    FROM (select left_value from LeftTable LEFT JOIN RightTable ON LeftTable.left_value = RightTable.right_value) as a
    GROUP BY a.left_value;

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

Similar Threads

  1. Help With an expression
    By kylem4711 in forum Queries
    Replies: 2
    Last Post: 04-23-2009, 01:57 PM
  2. Update with LEFT JOIN
    By mcarthey in forum Access
    Replies: 1
    Last Post: 08-27-2008, 10:49 AM
  3. Expression Builder
    By mistaken_myst in forum Access
    Replies: 2
    Last Post: 05-07-2008, 01:30 PM
  4. Replies: 1
    Last Post: 09-19-2006, 11:07 AM
  5. Dynamic Query Outer Join Problem
    By mjack003 in forum Queries
    Replies: 0
    Last Post: 07-21-2006, 01:07 PM

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