Click here to Skip to main content
15,912,457 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
HI
When i run this command

SQL
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

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)

SQL
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:

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



hth,
foxyland
 
Share this answer
 
v2
Duplicate where remove WHERE add AND only

You could face problem while comparing date with '' try to be specific put some values there
 
Share this answer
 
v2
You can try
SQL
where (Qaid_date between ''and'') and Bayan_Oll='VISA'
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900