Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Need to Insert 2 Fields into one Destination Field

$
0
0

I have a scenario in this way:

Source Table  

Inventory

Alocation| Blocation

ABC         DEF

Destination Table

LocationID

Mapping Table  

LocationID, Location

1               ABC

2               DEF

Now I have to write a query wherey both the location codes should be inserted into LocationID in Destination table

Normally If one Location was available I would have inserted, but I need to insert both the Records into Destination by mapping them to Mapping table

if one Location Was Available:

Insert Into DestinationTable

(LocationID)

Select M.LocationID From MappingTable M Join Sourcetable S Where M.location = S.ALocation

This would Output

Destination Table

LocationID

1

But I want to see this as 

Destination Table

LocationID

1

2

Please Help on this.

Thanks



Thanks, Please Help People When they need..!!! Mark as answered if your problem is solved.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



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