Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Query - Copy Data into One Field

$
0
0

I have a SQL database and I am writing a query:

SELECT *

FROM Consignments
INNER JOIN OrderDetail
ON Consignments.consignment_id = OrderDetail.consignment_id
INNER JOIN UserReferences
ON OrderDetail.record_id = UserReferences.record_id
WHERE Consignments.despatch_date = '2020-04-23'

Within the first column is:

consignment_id[this is from the Consignments table]

In the final column is:

senders_reference[this is from the UserReferences table]

Now - the issue I have is - that when I am running the query to pick up all consignments for a particular date - it is displaying multiple rows (with duplicated consignment_id) when there are multiple senders references within the database.

If there is one senders reference number - then there is only 1 row.

This makes sense - because within the front-end for the database the user can enter 1 or more senders...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>