Error 3258 --> Query in Query Help please?

Posted on 2006-06-11
Medium Priority
Last Modified: 2008-01-09
Hello All;

Could someone please assist me on this?

The following is the Tables:

ContentTypes ---> Site Content Directory
Cats ---> Categories
Sierra ---> Store Content for Sierra
BrushStrokes ---> Store Content for BS

I have "tried" to create a QUERY for the 4 Tables
(The code that I have, originally came with 3-Table Query connection
I have added in the 4th Table "BrushStrokes")

This is the Query that I created. Before the code, a little insite

At first there was: RIGHT & LEFT JOIN's, But I would receive this:
Error 3258
After not really finding any good examples of how to create the
2- Queries and have then work together as one.
I decided to try something else, which was to create all [INNER JOIN]'s
Which got rid of the Error, and the code still will not work in my site.
So I changed it back to the [RIGHT & LEFT JOIN's] for here.
Microsoft JET Database Engine error '80040e14'
Syntax error in JOIN operation.

So, here is the code, please let me know what is wrong with it?
And if possible, a good example of creating the [2 - Queries] that work as one.

Thank you all

============Access SQL Query====================
SELECT Cats.CatID, Sierra.CatID, BrushStrokes.CatID, Sierra.ContentID, BrushStrokes.BSContentID, Sierra.Product_Title, BrushStrokes.BSProduct_Name, Cats.CatDescription, Cats.CatTypeId, Sierra.Product_Th_Image, BrushStrokes.BSThumbnail, Sierra.Our_Price, BrushStrokes.BSPrice, Sierra.Retail_Price, BrushStrokes.BSRetail, Sierra.Aff_Name, BrushStrokes.Aff_Name, Sierra.Brand_Name, BrushStrokes.BSArtistName, Sierra.YAvailable, BrushStrokes.BSStatus, Sierra.Percent_Savings, Sierra.Unique_Product_ID, BrushStrokes.BSProductID, Sierra.Main_Cat, BrushStrokes.BSCol_Cat, ContentTypes.ContentType, Sierra.Product_Description, BrushStrokes.BSDescription
FROM ((ContentTypes RIGHT JOIN Sierra ON ContentTypes.ContentTypeID = Sierra.ContentTypeID) RIGHT JOIN BrushStrokes ON ContentTypes.ContentTypeID = BrushStrokes.ContentTypeID) LEFT JOIN Cats ON (BrushStrokes.CatID = Cats.CatID) AND (Sierra.CatID = Cats.CatID)
WHERE (((Sierra.Display)=1) AND ((BrushStrokes.Display)=1));

Now, here they are as 2-Queries. I do not have a clue how to make them work as "1 Query Together"?
SELECT Cats.Cat, Sierra.CatID, Sierra.ContentID, Sierra.Product_Title, Cats.CatDescription, Cats.CatTypeID, Sierra.Product_Th_Image, Sierra.Our_Price, Sierra.Aff_Name, Sierra.Retail_Price, Sierra.Brand_Name, Sierra.YAvailable, Sierra.Retail_Price, Sierra.Percent_Savings, Sierra.Unique_Product_ID, Sierra.Main_Cat, ContentTypes.ContentType, Sierra.Product_Description FROM ((ContentTypes RIGHT JOIN Sierra ON ContentTypes.contenttypeid = Sierra.contenttypeid) LEFT JOIN Cats ON Sierra.catid = Cats.catid) WHERE Display=1 ORDER BY Product_Title
SELECT Cats.Cat, BrushStrokes.CatID, BrushStrokes.BSContentID, BrushStrokes.BSProduct_Name, Cats.CatDescription, Cats.CatTypeId, BrushStrokes.BSThumbnail, BrushStrokes.BSPrice, BrushStrokes.BSRetail, BrushStrokes.Aff_Name, BrushStrokes.BSArtistName, BrushStrokes.BSStatus, BrushStrokes.BSProductID, BrushStrokes.BSCol_Cat, ContentTypes.ContentType, BrushStrokes.BSDescription
FROM (ContentTypes RIGHT JOIN BrushStrokes ON ContentTypes.ContentTypeID = BrushStrokes.ContentTypeID) LEFT JOIN Cats ON BrushStrokes.CatID = Cats.CatID
WHERE (((BrushStrokes.Display)=1))
ORDER BY BrushStrokes.BSProduct_Name;
==================END QUERIES======================

Thanks All;
Question by:Wayne Barron
  • 3
  • 2
LVL 58

Expert Comment

ID: 16882844
Hello carrzkiss

Your attemp looks like this:

    BS —> CT <— S —> Cats

You probably want to say that you want all records from both BS and S, but that is not possible. The "arrow heads" cannot meet one another, or "you cannot have two archers". You need to choose which is going to be your base table, for example:

    Cats1 <— BS <— CT —> S —> Cats2
    ( BS — CT — S ) —> Cats2

This will work if all records in the "store" tables have a ContentTypeID, but as such, your original queries:

    CT <— S —> Cats
    CT <— BS —> Cats

Cannot be combined into one, unless there is some one-to-one relationship between BS and S, but I don't think so.

You could explain as briefly as possible what your expected result would be...

LVL 31

Author Comment

by:Wayne Barron
ID: 16882891
This is what I am needing: (As Brief as possible)

I need to be able to [Search] the fields (In ASP Page(s))
The [Search] needs to be able to search across both Tables "S" & "BS" for Content to display to the user.
Then the User will choose the item that they want, and click to view more information about the Searched Return Item.

That hopefully should sum it up.
As that is what I am trying to accomplish, and have been trying for over 2-weeks now with
No success what so ever.

This is where it is going to get really tricky:
There will be an additional 15-20 [Table]'s added to the .mdb.
And all these Tables will have to be setup with the others as well.
So where ever I figure out here, I "hopefully" will be able to do with the Rest of the Tables that are added in
Later on down the road.

I just have to figure out how to display all the [Search] Results from the Table's in the Search_Results.asp page.
And then so forth for the Content_Display.asp pages for the indivisual pages.
(But that is another Post all together)

LVL 58

Expert Comment

ID: 16882984
If you say "search across both Tables", you need a union query. Even better, one single table with all your shop details. Why one table per shop? Anyway, that is not the point.

You need the shops one *below* the other, i.e. in different rows, not one *next* to the other, i.e. in different columns.

Use the union query as we discussed in http:Q_21878745.html

LVL 31

Author Comment

by:Wayne Barron
ID: 16883020
Can you explain this a little more

You need the shops one *below* the other, i.e. in different rows, not one *next* to the other, i.e. in different columns.

Yes, I have posted information the other Q_
LVL 58

Accepted Solution

harfang earned 1000 total points
ID: 16883065

AAA 123 Y
AAA 343 N
AAA 100 Y
BBB 111 Y
BBB 456 Y
BBB 222 N

*next* to one another

AAA 123 Y    BBB 111 Y
AAA 343 N    BBB 456 Y
AAA 100 Y    BBB 222 N


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question