mardi 12 novembre 2019

Table query, select data from table1, but only if user settings in table2 is set to a specific value

I got a problem with this query. Not sure what this type of problem is called, so have problems searching for a solution :(

I got two tables: configurations, users

Simple query:

$sql = "
SELECT
    *
FROM
    configurations
WHERE
    userid!='$userid' AND deleted='0' AND
    (
        id LIKE '%$filter%' OR
        type LIKE '%$filter%'
    )
ORDER BY
    createdate DESC
LIMIT
    $search_config_count
";

How can I make it, so I only get 'configurations' if users.smart='1' ?

My configurations table has a "userid" field, that match the ID of a user in the users table. That specific user need to have smart='1', for the configurations to be listed.

Aucun commentaire:

Enregistrer un commentaire