1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Where filter based on another table

Discussion in 'Community' started by iamwe, Jul 12, 2019.

  1. iamwe

    iamwe New Member

    Level: Community
    Hello,
    Thanks for your help. I am attempting to filter reservation data, based on current user id, and data from another table that has checked in reservations.
    I have attempted the following but, it does not filter, and all the user's reservations display even if they are old.
    I would like to filter out the reservations that have already been checked in, which are listed in a different table.

    Thanks for your help!!!

    Goal:
    1) call confirmed reservations (dbase: jos_vikbooking_orders.confirmnumber) with ($my->id)
    2) filter out reservations numbers that are already on file in another table (Check-ins)
    3) Desired result: only see reservations that are confirmed but not checked in.

    CURRENT CODE: Plugin databasejoin
    TAB Data
    Table: jos_vikbooking_order Value: confirmnumber Label: confirmnumber

    TAB Date-where
    WHERE ujid = {$my->id}
    AND 'jos_vikbooking_orders.confirmnumber' != 'register_check_in.reservation_id'
    ORDER BY id DESC

    //RESULT reservation confirmations data not filtered by check-in confirmation table of same DB.
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    The syntax is wrong in any case, with quotes '' you are comparing strings, not columns.

    Something like
    ...
    AND jos_vikbooking_orders.confirmnumber NOT IN (SELECT register_check_in.reservation_id FROM ...)
     

Share This Page