SQL In Static Id Wise Record Skip After Show Result

Example

SELECT
    pr.*,
    sub_cat.name AS subcategoryname
FROM
    products AS pr
    JOIN product_sub_categories AS sub_cat    ON sub_cat.id = pr.sub_category_id
    JOIN product_categories AS cat         ON cat.id = sub_cat.category_id
WHERE 
     pr.`is_discontinued` = 0
    AND pr.`is_active` = 1
    AND pr.deleted_by IS NULL
    AND sub_cat.`is_active` = 1
    AND cat.`is_active` = 1
    AND cat.id NOT IN (1,5)
    AND cat.deleted_by IS NULL
ORDER BY pr.name ASC , cat.id;

Popular posts from this blog

Yii Framework In Update Time View Image In Form

Add a new column to existing table in a migration

Ajax Toggle(on/off) on-click Update