[AccessD] A tricky query, for me!

David McAfee davidmcafee at gmail.com
Wed Jul 15 12:20:40 CDT 2009


Are you planning a design or do you already have it designed and need help
displaying the data in a query?

If you already have it designed, give us some table and field names.

OTTOMH, I can think of something like this

SELECT A.ProductID, A.ProductName, A.ProductDescription, H.CategoryName AS
HyperMktCat, S.CategoryName AS SprMktCat
FROM tblProducts A
     LEFT JOIN (SELECT ProductID, CategoryID, CategoryName FROM
tblCategories WHERE CategoryType = "Hypermarket) AS H
         ON A.ProductID = H.ProductID
     LEFT JOIN (SELECT ProductID, CategoryID, CategoryName FROM
tblCategories WHERE CategoryType = "Supermarket) AS S
         ON A.ProductID = S.ProductID

On Wed, Jul 15, 2009 at 8:45 AM, philippe pons <phpons at gmail.com> wrote:

> Hi all,
>
> I have products that are grouped by categories.
> I consider the categories.
>
> There are 2 main groups of categories:
> 1-categories for hypermarket
> 2-categories for supermarket
>
> there is a set of categories that are in both groups.
> but they are also categories that are for hyper only and other for super
> only.
>
> I need to display both lists side by side, in an alphabetic order.
>
> But a further constraint(and this is where I need aspirin!):
> a single line must show the same category name.
> if a category does not exist in the other group, there must a blank in its
> cell.
>
> A simple question: I would you do that?
>
> TIA,
>
> Philippe
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list