Solved

Error 3258 --> Query in Query Help please?

Posted on 2006-06-11
5
480 Views
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
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
Comment
Question by:Wayne Barron
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:harfang
Comment Utility
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
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
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
 
LVL 58

Expert Comment

by:harfang
Comment Utility
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
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
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
 
LVL 58

Accepted Solution

by:
harfang earned 250 total points
Comment Utility
*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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now