Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL QUERIES MATERIALS BY CODE

Author  Topic 

a_self_lion
Starting Member

6 Posts

Posted - 2010-07-23 : 03:53:33
Hello;

Excel VBA to use in my project, I prepared the following query. But I'm working When I get an error. How do I correct the query.



(SELECT GECENV_ID,STKID_NAME,GECENV_DEV_MIK,GECENV_GIR_MIK,GECENV_URT_MIK,GECENV_ART_MIK,GECENV_RZG_MIK,
GECENV_CIK_MIK,GECENV_IML_MIK,GECENV_EKS_MIK,GECENV_HAS_MIK,GECENV_IAD_MIK,GECENV_SAT_MIK
FROM GECENV
LEFT OUTER JOIN STKID ON STKID_ID = GECENV_ID
WHERE GECENV_CPFACD = '5' AND
GECENV_TAR = '2010-07-01' AND
((GECENV_ID BETWEEN ‘110501’ AND ‘110502') OR
(GECENV_ID BETWEEN ‘12’ AND ‘13’)) )


webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-23 : 04:31:15
It isn't a bad idea to post the error message...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-07-23 : 04:45:36
Table definitions might help too.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-23 : 11:55:17
one problem i see in your query is the apostrophe.

you are using slightly different than it should be used:
GECENV_CPFACD = '5' -- this one is OK
((GECENV_ID BETWEEN ‘110501’ AND ‘110502') -- the first three are NOT OK, last one is OK.

change this and it might work.

Go to Top of Page

a_self_lion
Starting Member

6 Posts

Posted - 2010-07-23 : 12:04:18
Thank you very much.
I think I ran from my eyes (') at this point I do not understand how come you had different signs.
Go to Top of Page
   

- Advertisement -