Having trouble with WHERE CLAUSE sub-selects statement. Trying to do a WHERE LIKE.

Having trouble with WHERE CLAUSE sub-selects statement. Trying to do a WHERE LIKE.

jawz302jawz302 Posts: 15Questions: 5Answers: 0

This is the only example I can find. Not quite sure what or why the 'accesslevel' in the front is there. Also not sure about the 'IN', false at the end. Can anyone explain in better detail what this example is doing or more importantly what the parts of the syntax are. I assume that 'accesslevel' is a column in the Database, so is 'id' and 'level' then 'access' is the name of the TABLE. No matter what I put in the place of these items, I cannot get the LIKE statement to work.

$editor->where( function ( $q ) {
$q->where( 'accessLevel', '(SELECT id FROM access WHERE level LIKE "%admin%")', 'IN', false );
} )

I want to SELECT all the rows FROM schedule WHERE PART# does not start with "Y"
$editor->where( function ( $q ) {
$q->where( 'PART#', '(SELECT * FROM schedule WHERE PART# NOT LIKE "Y%")', 'IN', false );
} )

Answers

  • jawz302jawz302 Posts: 15Questions: 5Answers: 0

    I figured it out. Trying to overkill it.
    $q->where( 'PART#','Y%','NOT LIKE' );

This discussion has been closed.