Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
SQL AND statement
Hi, How do i add and statement on the sql query?
For example this query:
$this->SQL
->Select('c.Name, c.CategoryID, c.TreeRight, c.TreeLeft, c.Depth, c.Description, c.CountDiscussions, c.CountComments, c.UrlCode, c.LastCommentID, c.PermissionCategoryID')
->Select('co.DateInserted', '', 'DateLastComment')
->Select('co.InsertUserID', '', 'LastCommentUserID')
->Select('cu.Name', '', 'LastCommentName')
->Select('cu.Photo', '', 'LastCommentPhoto')
->Select('co.DiscussionID', '', 'LastDiscussionID')
->Select('d.Name', '', 'LastDiscussionName')
->From('Category c')
->Join('Comment co', 'c.LastCommentID = co.CommentID', 'left')
->Join('User cu', 'co.InsertUserID = cu.UserID', 'left')
->Join('Discussion d', 'd.DiscussionID = co.DiscussionID', 'left')
->Where('c.AllowDiscussions', '1') ;
i would like to add an AND after the where statement like this "and status='2' "
How would i do that? Any idea please?
For example this query:
$this->SQL
->Select('c.Name, c.CategoryID, c.TreeRight, c.TreeLeft, c.Depth, c.Description, c.CountDiscussions, c.CountComments, c.UrlCode, c.LastCommentID, c.PermissionCategoryID')
->Select('co.DateInserted', '', 'DateLastComment')
->Select('co.InsertUserID', '', 'LastCommentUserID')
->Select('cu.Name', '', 'LastCommentName')
->Select('cu.Photo', '', 'LastCommentPhoto')
->Select('co.DiscussionID', '', 'LastDiscussionID')
->Select('d.Name', '', 'LastDiscussionName')
->From('Category c')
->Join('Comment co', 'c.LastCommentID = co.CommentID', 'left')
->Join('User cu', 'co.InsertUserID = cu.UserID', 'left')
->Join('Discussion d', 'd.DiscussionID = co.DiscussionID', 'left')
->Where('c.AllowDiscussions', '1') ;
i would like to add an AND after the where statement like this "and status='2' "
How would i do that? Any idea please?
Tagged:
0