Click here to Skip to main content
14,297,247 members
Rate this:
Please Sign up or sign in to vote.
HI
When i run this command

select sum(Maden) as مدين,sum(Dayn) as دائن from Ezn_Qaid
where Qaid_date between ''and''
where Bayan_Oll='VISA'


get this erorr

Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'where'.


PLZ Help Me

Thanks
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

You cannot have two where clause in one select query (unless you have a sub-query; but that means you have more than one select query anyway)

select sum(Maden) as مدين,sum(Dayn) as دائن from Ezn_Qaid
where Qaid_date between ''and'' and Bayan_Oll='VISA'


Anyway, date between '' and '' would generate error. If you don't need it, why not simply:

select sum(Maden) as مدين,sum(Dayn) as دائن from Ezn_Qaid
where Bayan_Oll='VISA'



hth,
foxyland
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 3

Duplicate where remove WHERE add AND only

You could face problem while comparing date with '' try to be specific put some values there
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can try
where (Qaid_date between ''and'') and Bayan_Oll='VISA'
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100