SQL utilization for connection to Database

SQL utilization for connection to Database

_462191288
Not applicable
4 Views
4 Replies
Message 1 of 5

SQL utilization for connection to Database

_462191288
Not applicable

[ FlexSim 22.1.2 ]


It already succeed to connect to Database(Microsoft Access).but as the below picture showing, it can not read data from database if using HAVING clause of SQL. On the contrary, it would make it if not using HAVING clause. how to address this problem? thank!

BTW, encounter the same issues if using ORDER BY clause.




image20220706085421.png


0 Likes
Accepted solutions (1)
5 Views
4 Replies
Replies (4)
Message 2 of 5

jason_lightfootVL7B4
Autodesk
Autodesk
Does the same SQL statement work in an Access Query?
0 Likes
Message 3 of 5

_462191288
Not applicable

Hi, so far not validate it in Access Query

0 Likes
Message 4 of 5

JordanLJohnson
Autodesk
Autodesk
Accepted solution

I think this is something specific to this combination of database file and query. I did an internet search for "odbc error number 07002" and found many different applications with the same issue. In each case, the resolution was to correct something about the query.

So, here are some things I would try:

  • Double check spelling/capitalization of all column/table names
  • Wrap all identifiers (column names, table names, aliases) in square brackets
  • Make sure you only use aliases, if you have declared them. For example, I'd try changing your GROUP BY statement to GROUP BY Item
  • Try the query in Access, to see if it is valid there, as @Jason Lightfoot suggests.

You could also try using a nested query instead of a HAVING clause, if ODBC supports nested queries:

SELECT Item, Max_SPQ FROM (
  SELECT [FLEX PART NO] AS Item, MAX([SPQ]) AS Max_SPQ FROM SPQ
  GROUP BY Item
) WHERE Max_SPQ > 1
.


Jordan Johnson
Principal Software Engineer
>

Message 5 of 5

_462191288
Not applicable

thank you very much Jordan. your answer in great, but need to do a little modification as the below picture, then it will work. 1657155443061.png

0 Likes