Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Anyone tell me what is wrong with this?

Hi
I have a strored procedure which part of it is as below..
It keeps syaing incorrect syntax...
ANyone tell me what is wrong?

      insert into  Details  (FIeld naems etcc)
                      SELECT     FIeld Names etc
                  FROM Another_Details left outer join users on aother_details.officer_id = users.attendant_id
                                        Where ID = @KeyID and Registration_No >''
                  WHERE     (Users.Account_Disabled = '0')

Obviously field names is jst a summary of the fileds in the table..
its the WHERE     (Users.Account_Disabled = '0') bit which has caused the problem...
Cheers
Mat
0
funkkube
Asked:
funkkube
1 Solution
 
momi_sabagCommented:
did you try
WHERE     (Users.Account_Disabled = 0)
?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you have 2 times WHERE...
also, the condition on the users table, as it is left joined, needs to be in the join itself.
insert into  Details  (FIeld naems etcc)
SELECT     FIeld Names etc
FROM Another_Details 
left outer join users 
  on aother_details.officer_id = users.attendant_id 
 and Users.Account_Disabled = '0'
Where Another_Details.ID = @KeyID 
 and Another_Details.Registration_No >''
                  

Open in new window

0
 
funkkubeAuthor Commented:
super thanks!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now