Welcome Guest, Not a member yet? Register   Sign In
Codeigniter4 How i can convert this builder query to normal ?
#4

In addition to this, if you don't want bunch of SQL code in your php file, I suggest adding this in a stored procedure then using builder you can just CALL `GetEmployeeDetails` ('search_String');

PHP Code:
DELIMITER //

CREATE PROCEDURE GetEmployeeDetails(
    IN search VARCHAR(255)
)
BEGIN
    SELECT 
        a
.id AS empid
        a.first_name AS name
        a.last_name AS last
        a.emp_code AS emp_code
        b.name AS division
        c.name AS department
        e.name AS designation
        d.name AS status
    FROM 
        employees_master a
    INNER JOIN 
        divisions 
AS b ON a.division_id b.id
    INNER JOIN 
        departments 
AS c ON a.department_id c.id
    INNER JOIN 
        employees_status_types d ON a
.employee_status_id d.id
    INNER JOIN 
        designations e ON a
.designation_id e.id
    WHERE 
        a
.first_name LIKE CONCAT('%'search'%')
        OR a.last_name LIKE CONCAT('%'search'%')
    GROUP BY 
        a
.id;
END //

DELIMITER 
Web developer creating tools for streamers
Countdown Tools: https://obscountdown.com
Reply


Messages In This Thread
RE: Codeigniter4 How i can convert this builder query to normal ? - by MMLTech - 03-30-2024, 10:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB