Friday, January 20, 2023

Join Multiple table with subquery

SELECT DISTINCT

    e.card_id,

    e.photo_link,

    c.full_name,

    c.mobile_no,

    c.email,

    c.image_path,

    s.institute_name,

    p.profession_name,

    p.institute_name AS company, 

    i.village_road_present,

    i.post_office_present,

    i.thana_upazila_present,

    i.district_present,

    i.blood_group

FROM EVENT

    e

JOIN(

    SELECT DISTINCT

        id,

        full_name,

        mobile_no,

        email,

        image_path

    FROM

        cualumni

    WHERE

        softdeleted = 'No'

) AS c

ON

    c.id = e.user_id

JOIN(

    SELECT DISTINCT

        user_id,

        institute_name

    FROM

        education

    WHERE

        user_id IS NOT NULL

) AS s

ON

    s.user_id = e.user_id

JOIN(

    SELECT DISTINCT

        user_id,

        profession_name,

        institute_name

    FROM

        profession

    WHERE

        user_id IS NOT NULL

) AS P

ON

    P.user_id = e.user_id

JOIN(

    SELECT DISTINCT

        *

    FROM

        personal_info

    WHERE

        user_id IS NOT NULL

) AS i

ON

    i.user_id = e.user_id

No comments:

Post a Comment

Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...