Solved

Error 3258 --> Query in Query Help please?

Posted on 2006-06-11
5
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:harfang
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...

(°v°)
0
 
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)

Wayne
0
 
LVL 58

Expert Comment

by:harfang
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

Cheers!
(°v°)
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 16883020
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
ID: 16883065
*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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

717 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