473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error in an INNER JOIN

31
My Query is as follows:

Select [Q] .[QUE$TOR version name],[Q].[Cost Tab], sum([Q].[Cost]) as Cost FROM [QUESTOR Run tbl] as Q INNER JOIN [Project info tbl] as [P] ON [P].[Project ID]=[Q].[Project ID] INNER JOIN (Select [P].[Project ID],[P].[Onshore only] FROM [Project info Tbl] as P INNER JOIN [QUESTOR Run Tbl] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [P].[Project ID],[P].[Onshore only] HAVING [P].[Onshore only]=yes) as Q1 ON [P].[Project ID]=[Q1].[Project ID] GROUP BY [Q].[QUE$TOR Version name],[Q].[Cost Tab] HAVING ([Q].[QUE$TOR Version name])=”7.3” AND ([Q].[Cost Tab] NOT LIKE “%drilling%”)


Can somebody tell me what is wrong in this join. Thank you.
Jul 13 '07 #1
6 1849
JKing
1,206 Expert 1GB
What error message are you receiving? It will be easier to find the error if we know what it is.
Jul 13 '07 #2
Flo100
31
What error message are you receiving? It will be easier to find the error if we know what it is.

Syntax error(missing operator) in query expression [P].[Project ID]=[Q].[Project ID] (Select [P].[Project ID],[P].[Onshore only] FROM [Project info Tbl] as P INNER JOIN [QUESTOR Run Tbl] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [P].[Project ID],[P].[Onshore only] HAVING [P].[Onshore only]=yes)

This is the error.
Jul 13 '07 #3
Flo100
31
Syntax error(missing operator) in query expression [P].[Project ID]=[Q].[Project ID] (Select [P].[Project ID],[P].[Onshore only] FROM [Project info Tbl] as P INNER JOIN [QUESTOR Run Tbl] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [P].[Project ID],[P].[Onshore only] HAVING [P].[Onshore only]=yes)

This is the error.

My actual query should look something like this:

Select Q2.[QUE$TOR version name], sum(Q2.[Cost]) from (Select [Q] .[QUE$TOR version name],[Q].[Cost Tab], sum([Q].[Cost]) as Cost FROM [Project Run tbl] as [P] INNER JOIN (Select [P].[Project ID],[P].[Onshore only] FROM [Project Run tbl] as P INNER JOIN [QUESTOR Run Tbll] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [P].[Project ID],[P].[Onshore only] HAVING [P].[Onshore only]=yes) as Q1 ON [P].[Project ID]=[Q1].[Project ID] INNER JOIN [QUESTOR Run tbl] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [Q].[QUE$TOR Version name],[Q].[Cost Tab] HAVING ([Q].[QUE$TOR Version name])=”7.3” AND ([Q].[Cost Tab] NOT LIKE “%drilling%”)) as Q2 GROUP BY [Q2.[QUE$TOR Version name]



I am trying to get the projects that are onshore only from project info tbl and sum the costs for version 7.3 whose cost tab value does not say drilling. now because this is a multivalued column i am not able to sum in one query so i am querying the result third time again on Q2 for sum...............i donno if this gave you even a pinch of idea about what i want to do. But i hope so, please let me know and i can write a complete explanation.
Jul 13 '07 #4
Flo100
31
My actual query should look something like this:

Select Q2.[QUE$TOR version name], sum(Q2.[Cost]) from (Select [Q] .[QUE$TOR version name],[Q].[Cost Tab], sum([Q].[Cost]) as Cost FROM [Project Run tbl] as [P] INNER JOIN (Select [P].[Project ID],[P].[Onshore only] FROM [Project Run tbl] as P INNER JOIN [QUESTOR Run Tbll] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [P].[Project ID],[P].[Onshore only] HAVING [P].[Onshore only]=yes) as Q1 ON [P].[Project ID]=[Q1].[Project ID] INNER JOIN [QUESTOR Run tbl] as Q ON [P].[Project ID]=[Q].[Project ID] GROUP BY [Q].[QUE$TOR Version name],[Q].[Cost Tab] HAVING ([Q].[QUE$TOR Version name])=”7.3” AND ([Q].[Cost Tab] NOT LIKE “%drilling%”)) as Q2 GROUP BY [Q2.[QUE$TOR Version name]



I am trying to get the projects that are onshore only from project info tbl and sum the costs for version 7.3 whose cost tab value does not say drilling. now because this is a multivalued column i am not able to sum in one query so i am querying the result third time again on Q2 for sum...............i donno if this gave you even a pinch of idea about what i want to do. But i hope so, please let me know and i can write a complete explanation.
Is my intention in joining three queries into one not right?
Jul 13 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
OK your subselect on a subselect is very messy. What are you trying to do and what is the structure of your tables.
Jul 17 '07 #6
Flo100
31
OK your subselect on a subselect is very messy. What are you trying to do and what is the structure of your tables.
My main problem is that the table structure is not proper and I need to work on it as it is given. But I figured out how do it. I simply created each subquery as another query. Thank you very much for your help and concern.
Jul 18 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: DaylonRed | last post by:
Could someone help me out here? I have created a pretty large Stored Procedure with about 5 different parameters however, when I run the procedure I get the following error: "Syntax error...
3
by: Matias Silva | last post by:
Hi Everyone, I wrote a for loop to build several select statements that are combined with a UNION. When I execute one of the queries separately, it works, but when I execute the query with a UNION...
1
by: dbuchanan | last post by:
VB.NET 2003 / SQLS2K The Stored Procedure returns records within Query Analyzer. But when the Stored Procedure is called by ADO.NET ~ it produced the following error message. ...
0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
2
by: Susan Bricker | last post by:
I went back to read my post and found an error in my description ... here is the post, again, corrected: The following error: "The current field must match the join key '?' in the table that...
0
by: EJO | last post by:
Thanks everyone! My workgroup is in a mixed enviroment for using an Access 2k mde as the front end of a sql server 2000 which is running on the same machine that some of my users access using...
2
by: javediq143 | last post by:
Hi all, I set up a simple access database.Earlier my ASP page was working fine,but dont know whats gone wrong that it started to give me this Err: Error Type: Provider (0x80004005) Unspecified...
2
by: speavey | last post by:
When I run this query, I get an ORDER BY error "Incorrect syntax near the keyword 'ORDER'. I've bolded it below. If I take the ORDER by out then it works correctly, but I need the ORDER BY...
2
by: MATTXtwo | last post by:
i have some experience on that thing...some logical error maybe.. coz it works perfectly on different login id that i always use.. i use store procedure and maybe it got some error in it.. please...
4
by: AXESMI59 | last post by:
I created a query in the Access Query Builder that I modified to use with VBA Code so I could reuse it for any record I choose. The one that I created with the Access Query builder works beautifully...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.