Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my application

I used a query ,returns 14 rows.

I need to add a column to this result ( from a other teble).

I got by use of inner join but it returns more than 14 rows.

I just need to display a 'date ' in 14 rows ,the date is same for 14 rows.
The added column tacble containd a reference field.
query as below

SQL
SELECT distinct  '99991', tbl_DisclosureTypeDetails.disclodetDisclosureId,isnull( tbl_Disclosures.Disclosures,'') AS Expr1
FROM         tbl_DisclosureTypeDetails INNER JOIN
                      tbl_Disclosures ON tbl_DisclosureTypeDetails.disclodetDisclosureId = tbl_Disclosures.DiscId
WHERE     (tbl_DisclosureTypeDetails.disclodetMasterId = (SELECT     BMDisclosure
                            FROM          tbl_BorrowersMaster
                            WHERE      BMId =    223)) and tbl_DisclosureTypeDetails.disclodetDisclosureId  NOT IN(SELECT     BMCDisclosures
FROM         tbl_BorrowersMasterChild
WHERE     (BMCBorrowerID =    223))
Posted
Updated 31-May-10 20:22pm
v2

1 solution

You can do this as following.

 SELECT distinct  '99991', tbl_DisclosureTypeDetails.disclodetDisclosureId,isnull( tbl_Disclosures.Disclosures,'') AS Expr1,  (SELECT TOP 1 DATE_COLUMN FROM SOMEOTHERTABLE WHERE [CONDITION]) AS NEWCOLUMN
FROM        .......

The other way is to store the column in a temp table and update the date column afterwards and finally return the result form the temp table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900