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

Removing Field Value From Certain Records (SQL Server)

$
0
0

I'm trying to remove (or make null) the PO_NUM field for all records of RCD_TYP = D for the union between the two views. The problem is, both views are related by the PO_NUM field and need to be ordered by PO_NUM and RCD_TYP.

The code I have for the views and union are as follows. I'm trying to create a table the represents a file that shows the header record first (RCD_TYP=H) followed by the details for each header (RCD_TYP=D) for each purchase order number: (Commented fields are fields from the original table but are not needed)

SQL
selecttopPARTNER_ID,STAT,NULLASFILLER1,NULLASFILLER2,SHIP_TO_ID,[PO_NO],NULLASSEQ_NO,RCD_TYP,PO_DAT,NULLASPRODUCT_ID,NULLASDESCR,NULLASORD_QTY,[VEND_NO],TERMS,REQ_SHIP_DAT,SHIP_TO_ARRIV_DAT-- ,LOC_ID-- ,SHIP_NAM-- ,SHIP_ADRS_1-- ,SHIP_ADRS_2-- ,SHIP_ADRS_3-- ,SHIP_CITY--...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



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