0

I need to delete records from three tables at a time.Here is my query:-

$query =$this->db->query("DELETE ps_faq_categories FROM ps_faq_categories INNER JOIN ps_faqs ON('ps_faq_categories.faq_category_id = ps_faqs.faq_category_id') 
                     INNER JOIN ps_faq_comments ON('ps_faqs.faq_id = ps_faq_comments.faq_id') WHERE 'ps_faq_categories.faq_category_id' = $category_id");

I am getting error like , An expression of non-boolean type specified in a context where a condition is expected, near 'INNER'.

1 Answer 1

0

remove single quote from the query

$query =$this->db->query("DELETE ps_faq_categories,ps_faqs,ps_faq_comments FROM ps_faq_categories INNER JOIN ps_faqs ON(ps_faq_categories.faq_category_id = ps_faqs.faq_category_id) 
                     INNER JOIN ps_faq_comments ON(ps_faqs.faq_id = ps_faq_comments.faq_id) WHERE ps_faq_categories.faq_category_id = $category_id");
Sign up to request clarification or add additional context in comments.

5 Comments

I have tried this , but havent solved am getting error, Incorrect syntax near '`'
The record deleted from ps_faq_categories but not deleting from ps_faqs and ps_faq_comments.Is their any problem in my query
Unfortunately it doesnt work , [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near ','.
the multi-part identifier "ps_faq_categories.faq_category_id" could not be bound.
i updated the query and check this link stackoverflow.com/questions/2214433/… it will may be help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.