Avatar of tmajor99
tmajor99

asked on 

SQL Select - Inserting a new column into the result set

I need a SQL Select that will insert a new column with a static values into the result set.  I need a new column called "Attribute Name" with the value set to "SUBS_ID" inserted into the result set from the SQL below,

SELECT TABLE1.ID, TABLE2.Trilogie_SUBS_ID  
FROM TABLE1
INNER JOIN TABLE2
ON TABLE1.S_MASTER.PRODUCT = TABLE2.S_MASTER.PRODUCT

This what I want the result set to look like:
ID         Trilogie_SUBS_ID       Attribute Name
303           600                          SUBS_ID
Microsoft SQL Server

Avatar of undefined
Last Comment
Scott Pletcher
ASKER CERTIFIED SOLUTION
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SELECT TABLE1.ID, TABLE2.Trilogie_SUBS_ID, 'SUBS_ID' AS [Attribute Name]
...
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo