Trouble with large query

Joined
Jun 30, 2011
Messages
1
Reaction score
0
Hi

I am having a bit of difficulty with a query that I am trying to use, and I believe it is due to the size. I would like to see if there is any workaround or some way to make this work. Also, I am using this as an MS Excel data retrieve, if that makes any difference. So here are the parameters I need to specify:

1. Year (only one input, i.e. choose the year)
2. Unit (I would like the user to be able to choose any combination of 100 options, so 100 parameters)
3. Location (the user would specify a start and end position, so in this is in between two values)
4. Department (same as location, the user specifies a start and end position)
5. Account (same as location/department, the user specifies a start and end position)

So, I quickly learned that a single criteria can handle only 43 of the units in one line because the statement "Is One Of" only supports that many characters. Thus, I would need three lines, so I have it like this:

[Year] [Units 1 - 40] [Start and end loc] [Start and end dept] [Start and end dept]
[Year] [Units 41 - 80] [Start and end loc] [Start and end dept] [Start and end dept]
[Year] [Units 81 - 100] [Start and end loc] [Start and end dept] [Start and end dept]

The problem I encounter is that when I get somewhere in the third row, if I try to refresh, I get the error:

SQL0104 - Token [ was not valid. Valid tokens: ( + ? : DAY NOT RRN CASE CHAR DATE DAYS HASH HOUR LEFT

Is there any more efficient way I can do this so that it works?

Furthermore, if I try to just have two lines, basically limited the input to 80 units, it works, but it actually asks for the units 1 - 40 twice, which got me thinking that if it is trying to get those parameters twice, maybe if I can fix that then it would have enough room for the third segment for 81 - 100? Or maybe my thought process is incorrect.

Any help is appreciated and I am very inexperienced with SQL or the queries... my only experience is working with the editor that comes up where you specifiy the criteria field, values, etc., (not the actual SQL statement).

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top