﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / sql query implementaion / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 03:30:53 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>just we add else statement here    case when MaxSalary is not null then 'Yes'  else 'no'  end MaxSalary,    case when MinSalary is not null then 'Yes'  else 'no'   end MinSalary</description><pubDate>Mon, 03 Dec 2012 00:33:19 GMT</pubDate><dc:creator>asranantha</dc:creator></item><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>[quote][b]asranantha (12/2/2012)[/b][hr]k i got it[/quote]Are you sure?  Post the code with your changes.</description><pubDate>Sun, 02 Dec 2012 22:42:38 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>k i got it</description><pubDate>Sun, 02 Dec 2012 21:14:23 GMT</pubDate><dc:creator>asranantha</dc:creator></item><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>[quote][b]asranantha (12/2/2012)[/b][hr]thanks its working fine.  in this query i want modify when max salary then display yes and remaing sal column display no and when min salary then display yes and remaing sal columns no.pls tell me query[/quote]Don't think so.  You should be able to figure this out based on what I have already provided.It is a minor change to what I provided.</description><pubDate>Sun, 02 Dec 2012 11:02:04 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>thanks its working fine.  in this query i want modify when max salary then display yes and remaing sal column display no and when min salary then display yes and remaing sal columns no.pls tell me query</description><pubDate>Sun, 02 Dec 2012 10:43:27 GMT</pubDate><dc:creator>asranantha</dc:creator></item><item><title>RE: sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>[quote][b]asranantha (12/2/2012)[/b][hr]hi friend i have a small doubt in sql server plz tell me how to solve table data contins like    id,name,sal                                  1,abc,1200                                  2,jaid,5300                                  3,union,1000                                  4,ravod.200i want output like                            id , name,  sal ,  max(sal),   min(sal)                           1   ,abc   ,1200  ,   null      , null                            2  ,jaid   ,5300   ,  yes       , null                            3,union ,  1000  , null         ,null                            4,ravod ,200     ,null         ,   yeswhen ever max value find that time display yes other wise display null values and when ever min valu find that time  disply yes other wise display null values .plz tell me how to write query in sql server[/quote]This should do what you want:[code="sql"]/*table data contins like id,name,sal1,abc,12002,jaid,53003,union,10004,ravod.200i want output likeid , name, sal , max(sal), min(sal)1 ,abc ,1200 , null , null2 ,jaid ,5300 , yes , null3,union , 1000 , null ,null4,ravod ,200 ,null , yes*/create table #TestTable(    id int,    name varchar(10),    salary int);goinsert into #TestTablevalues    (1,'abc',1200),    (2,'jaid',5300),    (3,'union',1000),    (4,'ravod',200);gowith MaxSalary as (select    max(salary) MaxSalaryfrom    #TestTable), MinSalary as (select    min(salary) MinSalaryfrom    #TestTable)select    id,    name,    salary,    case when MaxSalary is not null then 'Yes' end MaxSalary,    case when MinSalary is not null then 'Yes' end MinSalaryfrom    #TestTable tt    left outer join MaxSalary ms1        on (tt.salary = ms1.MaxSalary)    left outer join MinSalary ms2        on (tt.salary = ms2.MinSalary)godrop table #TestTable;go[/code]</description><pubDate>Sun, 02 Dec 2012 09:54:26 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>sql query implementaion</title><link>http://www.sqlservercentral.com/Forums/Topic1391733-391-1.aspx</link><description>hi friend i have a small doubt in sql server plz tell me how to solve table data contins like    id,name,sal                                  1,abc,1200                                  2,jaid,5300                                  3,union,1000                                  4,ravod.200i want output like                            id , name,  sal ,  max(sal),   min(sal)                           1   ,abc   ,1200  ,   null      , null                            2  ,jaid   ,5300   ,  yes       , null                            3,union ,  1000  , null         ,null                            4,ravod ,200     ,null         ,   yeswhen ever max value find that time display yes other wise display null values and when ever min valu find that time  disply yes other wise display null values .plz tell me how to write query in sql server</description><pubDate>Sun, 02 Dec 2012 09:29:16 GMT</pubDate><dc:creator>asranantha</dc:creator></item></channel></rss>