Page 1 of 1

Records not showing in browse forms

Posted: Wed Apr 16, 2025 12:36 am
by Lala
Hi, some of my records aren't showing up in the browse forms - it seems to be random whether they are or not. They are in the database - I checked on phpMyAdmin. A specific example of this is in the patients table, registry no 2025-23. Just to add to the issue, I can't attach a backup file to this as I get a message saying it is the wrong file-type being .sql - solved by zipping the file

Re: Records not showing in browse forms

Posted: Wed Apr 16, 2025 5:20 am
by Lala
I've discovered it only applies to 8 records so I have decided to delete them and re-enter them. It has something to do with making a unique index on the registration numbers - which I've removed now

Re: Records not showing in browse forms

Posted: Fri Apr 18, 2025 12:10 am
by steven
Hi Lala,

The reason for some records not appearing is because not all of your patients have a treatment.

A normal SQL JOIN returns only records that match...

Code: Select all

SELECT
 patients.*,
    treatments.*

FROM
    patients
        JOIN treatments ON patients.patients_id = treatments.tx_pat_id

But if you replace JOIN with LEFT JOIN you'll get back all patients even if they don't have a matching treatment.

Code: Select all

SELECT
 patients.*,
    treatments.*

FROM
    patients
        LEFT JOIN treatments ON patients.patients_id = treatments.tx_pat_id

eg.

left.png


Steven