Results 1 to 4 of 4

Thread: Trying to make a conditional join

  1. #1

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Trying to make a conditional join

    Can someone tell me why the following code wont work? I think it's pretty self explonatory so no need try explain what I want to do. (ask if need)

    Code:
    SELECT * FROM messages AS msg
    CASE msg.app_type
        WHEN 'study_abroad' THEN LEFT JOIN apps_study_abroad ON msg.application_id=apps_study_abroad.id
        WHEN 'study_in_china' THEN LEFT JOIN apps_study_in_china ON msg.application_id=apps_study_in_china.id
    END CASE
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Trying to make a conditional join

    How about just joining both 3 tables and just put a where clause at the end?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Trying to make a conditional join

    yeah, that should work. thanks mate
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Trying to make a conditional join

    no problem mate. =)
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width