0

I have table like this i want to get only one row for given budget id Here is the data.

INPUT: input

OUTPUT: output

1
  • You can group the data by BudgetId, but you need to decide how you want to summarize the other columns if you want to display the other columns. Because you're trying to display the "Initiator" for both 10002 rows in the same cell, how should the "Null" and "2" be handled? You need to summarize them with an aggregate function like MIN or AVG Commented Dec 27, 2017 at 16:01

1 Answer 1

1

Use Min/Max aggregate

SELECT MontlyBugetId,
       Min(Initiator),Min(Stage1),Min(Stage2),Min(Stage3),Min(Stage4),Min(StatusId)
FROM   yourtable
GROUP  BY MontlyBugetId 

If this is your table data, then you need to update the records instead of insert to avoid duplicate records

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.