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.
>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.