Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Error 3258 --> Query in Query Help please?

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
Carrzkiss

============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"?
=============Query1============================
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
=============Query2=============================
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;
Carrzkiss
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

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...

(°v°)
Avatar of Wayne Barron

ASKER

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)

Wayne
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

Cheers!
(°v°)
Can you explain this a little more

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

Yes, I have posted information the other Q_
ASKER CERTIFIED SOLUTION
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial