• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

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
0
Wayne Barron
Asked:
Wayne Barron
  • 3
  • 2
1 Solution
 
harfangCommented:
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°)
0
 
Wayne BarronAuthor Commented:
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
0
 
harfangCommented:
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°)
0
 
Wayne BarronAuthor Commented:
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_
0
 
harfangCommented:
*below*

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

(°v°)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now