Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Select SQL Duplicate Data

I have 2 table. Payment (28 Field/Column) and Users.

In the payment table there is a CreatedBy column which is taken from the Users table. Here’s the code

select 
  *, 
  users.Userid 
from 
  payment 
  left join users on users.Userid = payment.CreatedBy 
where 
  payment.PatientInvoiceID = ${id}
  and payment.DeletedBy is null

I just need to get Name from table Users to table Payment so I can get the Name of the user. But the data Duplicated into 59 Field/Column. Can Anyone Help me?. I’m sorry if my english is bad.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You want

select payment.*, users.Userid 
...

The asterix means "all". select * means all columns, and as you join two tables, this is all columns of the two tables. select payment.* means all columns of the payment table.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading