How to write a SQL Server query to summarise table data? -
I need help with a SQL Server query I have a table like this:
< Code> user_id display_name user named_on ----------------------------- --------------- ------------------------ 2012772 users1. Username 450 9 8885 2012772 user 1 DisplayName 451124897 2155281 User2.UserName 451045840 2162145 User3.UserName 451147363 2162145 User3.DisplayName 451147423And I need output as below: If the displayed name for the user is present then with update_on - Updated with other user name and its submission.
user_id display_name_computed updated_on ---------------------------------- --- --------------- 2012772 user1 Display 451124897 2155281 user2. User Name 451045840 2162145 User 3 Display name 451147423
Should be accompanied by the selection of SQL statement. No floating tables or table variables do not use No delete statements use.
Here you go
select user_id, < Display_name_computer as updated_on from your table of table, maximum (display_name) as maximum (updated_on), maximum (user name) by / pre>
Comments
Post a Comment