Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread LIST function
Thu, Jul 9 2009 3:42 AMPermanent Link

Richard Harding
Tim,

I have 2 tables below.

ContactRoles (ID, ContactID, RoleTypeID)
RoleTypes (ID, Name)


I wish to list the roles for a contact, say Fred is an Accountant,Conveyancer

Query 1 & Query 2 below give the same results when Fred has some roles assigned.  If Fred
does not have any roles then Query 1 and Query 2 give different results.


SELECT *
  FROM ContactRoles
     INNER JOIN RoleTypes ON ContactRoles.RoleTypeID = RoleTypes.ID
  WHERE ContactID = 10968

Gives an empty result set.

Query 1
---------

SELECT List(Name) AS ContactRoleList
  FROM ContactRoles
     INNER JOIN RoleTypes ON ContactRoles.RoleTypeID = RoleTypes.ID
  WHERE ContactID = 10968
  GROUP BY ContactID

Gives a NULL ContactRoleList which is correct.

Query 2
---------

Take the GROUP BY clause out, then obtain different results.

SELECT List(Name) AS ContactRoleList
  FROM ContactRoles
     INNER JOIN RoleTypes ON ContactRoles.RoleTypeID = RoleTypes.ID
  WHERE ContactID = 10968

Gives a ContactRoleList of Vendor Solicitor - Vendor Solictor is the first item in
ContactRoles table.

Richard Harding
Thu, Jul 9 2009 11:35 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

<< Take the GROUP BY clause out, then obtain different results. >>

Got it.  A fix will be in the next build.

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Jul 13 2009 12:48 AMPermanent Link

Richard Harding
>> Got it.  A fix will be in the next build.

Thanks Tim . . . .


Richard Harding
Image