UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Create View From Access Query    
 
   
LiketoFly
post Apr 17 2012, 04:49 PM
Post #1

New Member
Posts: 18



Hi All,

I am trying to create a view from an Access Query and am struggling.

CODE
SELECT     [tblDatesandM&Es].ForecastDate, [tblDatesandM&Es].ME_PART_NUMBER,
                          (SELECT     COUNT([Min Date])
                            FROM          [tblJustM&EandMinDate]
                            WHERE      [tblJustM&EandMinDate].[Min Date] BETWEEN [tblDatesandM&Es].[ForecastDate] - [tblTATStats].[AvgOfTAT] AND
                                                   [tblDatesandM&Es].[ForecastDate] + [tblTATStats].[AvgOfTAT] AND
                                                   [tblJustM&EandMinDate].[ME_PART_NUMBER] = [tblDatesandM&Es].[ME_PART_NUMBER]) AS Bunching,
                      tblCOQforCalculation.Count AS COQ, CASE WHEN ([Count] >= 4) THEN ([Count] * 0.5) ELSE '2' END AS [COQ Threshold],
FROM         (tblCOQforCalculation INNER JOIN
                      ([tblDatesandM&Es] INNER JOIN
                      [tblJustM&EandMinDate] ON [tblDatesandM&Es].ME_PART_NUMBER = [tblJustM&EandMinDate].ME_PART_NUMBER) ON
                      tblCOQforCalculation.ME_PART_NUMBER = [tblDatesandM&Es].ME_PART_NUMBER) INNER JOIN
                      tblTATStats ON [tblDatesandM&Es].ME_PART_NUMBER = tblTATStats.ME_PART_NUMBER;


Here is my code so far. I am new at T SQL.

I am also getting the following error:

Error Source: .Net SqlClient Data Provider
Error Message: Incorrect Syntax near keyword 'FROM'

Can anyone with experienced eyes see if there is something wrong with my Query? This is pulled from Access 2003, i just edited the IIF to a CASE Function so far.
Go to the top of the page
 
+
nijinsky
post Apr 18 2012, 08:23 AM
Post #2

UtterAccess Addict
Posts: 165
From: Cape Town, South Africa



I'm also a newbie at this but I feel it might have something to do with the last comma before the word FROM.
HTH

This post has been edited by nijinsky: Apr 18 2012, 08:26 AM
Go to the top of the page
 
+
LiketoFly
post Apr 18 2012, 11:31 AM
Post #3

New Member
Posts: 18



OMG, I am an idiot. Thanks so much it worked.
Go to the top of the page
 
+
RCJT
post Apr 23 2012, 02:50 PM
Post #4

UtterAccess Addict
Posts: 171
From: Southern CA



I'm not completely sure of a fix. I am wondering if the "&" character in your table name has caused any odd issues? JT
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 05:08 AM