getting common data
-
i have 3 tables named as patient, medicine, attachment patient table has columns name as patient_id patient_name medicine tables has columns med_id medicine_name patient_id and attachment has columns attachment_id attachment patient_id now i want data as patient_name medicine_name attachment where attachment_table has 2 or more columns who have same patient_id same as happn with attachment table but the main problem is i want to get all the data into a single row even if attachment has particular patient or no same as if medicine table has particular patient_id or no so can any one help me in it
-
i have 3 tables named as patient, medicine, attachment patient table has columns name as patient_id patient_name medicine tables has columns med_id medicine_name patient_id and attachment has columns attachment_id attachment patient_id now i want data as patient_name medicine_name attachment where attachment_table has 2 or more columns who have same patient_id same as happn with attachment table but the main problem is i want to get all the data into a single row even if attachment has particular patient or no same as if medicine table has particular patient_id or no so can any one help me in it
Patient
Patient_id
Patient_nameMedicine
med_id
medicine_name
patient_idattachment
attachment_id
attachment
patient_idLet's use "Coffee" as a sample medication; if both you and me were to be medicated with coffee, the medicine would need to be inserted into the "medicine" table twice. That's a modelling error.
Arun kumar Gautam wrote:
now i want data as
patient_name medicine_name attachmentI'd suggest you first fix your database-model. You can try Normalization[^] to correct it, or hope that someone else comes up with a different design. FWIW, it'd be best to register which patient takes which medication in a separate table. Once you have that, it's easy to join the tables and display them in a single row. Further, I'd also recommend to change the naming-pattern of the fields. As is, the name of the table is often repeated in the fieldname, wich is redundant.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
i have 3 tables named as patient, medicine, attachment patient table has columns name as patient_id patient_name medicine tables has columns med_id medicine_name patient_id and attachment has columns attachment_id attachment patient_id now i want data as patient_name medicine_name attachment where attachment_table has 2 or more columns who have same patient_id same as happn with attachment table but the main problem is i want to get all the data into a single row even if attachment has particular patient or no same as if medicine table has particular patient_id or no so can any one help me in it
Hi Arun kumar Could you provide sample data for understanding purpose and from that how you want the data could you give sample output Regards, Prakash.ch