Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wewe_2090
Starting Member
4 Posts |
Posted - 2014-04-04 : 08:33:31
|
Hi,i would like to write a SQL query from database table_A (original from database) to display in table B.original from database, table_Ai want to write the SQL query to display it like below:please help.thank you |
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2014-04-05 : 00:51:06
|
SELECT DISTINCT Gid , Name , CASE WHEN MAX(Pic) = 'Group Leader(Checker)' THEN 'Group Leader(Checker)' END AS Pic1, CASE WHEN MIN(Pic) = 'Design Manager(Approver)' THEN 'Design Manager(Approver)' END AS Pic2 FROM @Table GROUP BY GID,Name ORDER BY GidVeera |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-04-05 : 04:21:02
|
do you have max 2 pic for each GID & NAME ? KH[spoiler]Time is always against us[/spoiler] |
|
|
wewe_2090
Starting Member
4 Posts |
Posted - 2014-04-06 : 23:20:04
|
quote: Originally posted by VeeranjaneyuluAnnapureddy SELECT DISTINCT Gid , Name , CASE WHEN MAX(Pic) = 'Group Leader(Checker)' THEN 'Group Leader(Checker)' END AS Pic1, CASE WHEN MIN(Pic) = 'Design Manager(Approver)' THEN 'Design Manager(Approver)' END AS Pic2 FROM @Table GROUP BY GID,Name ORDER BY GidVeera
thank you. it is solved. |
|
|
|
|
|