Click here to Skip to main content
15,905,776 members
Home / Discussions / Database
   

Database

 
GeneralRe: Selecting the latest records Pin
Harini N K29-Apr-08 0:13
Harini N K29-Apr-08 0:13 
GeneralRe: Selecting the latest records Pin
Kevin Brydon30-Apr-08 6:45
Kevin Brydon30-Apr-08 6:45 
GeneralRe: Selecting the latest records Pin
Blue_Boy30-Apr-08 10:16
Blue_Boy30-Apr-08 10:16 
GeneralLimit Rows in DataTable Pin
Brady Kelly28-Apr-08 23:15
Brady Kelly28-Apr-08 23:15 
QuestionSelecting 3 columns and merging??? Pin
Karan_TN28-Apr-08 21:46
Karan_TN28-Apr-08 21:46 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy28-Apr-08 22:07
Blue_Boy28-Apr-08 22:07 
GeneralRe: Selecting 3 columns and merging??? Pin
Karan_TN28-Apr-08 22:32
Karan_TN28-Apr-08 22:32 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy28-Apr-08 22:37
Blue_Boy28-Apr-08 22:37 
Instead harcoded 'z' condition then modified query looks like this:
select distinct cola <br />
from myTable<br />
union all<br />
select distinct colb from myTable where colb <> (select top 1 cola from myTable order by cola desc)<br />
union all<br />
select distinct t3.colc from myTable as t3 <br />
where t3.colc <=(select top 1 colc from myTable order by colc desc)<br />
and t3.colc >(select top 1 colb from myTable order by colb desc) 



result of this query comes from one table in my case named myTable


I Love T-SQL

GeneralRe: Selecting 3 columns and merging??? Pin
Karan_TN28-Apr-08 22:54
Karan_TN28-Apr-08 22:54 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy28-Apr-08 23:46
Blue_Boy28-Apr-08 23:46 
GeneralRe: Selecting 3 columns and merging??? Pin
Karan_TN29-Apr-08 0:10
Karan_TN29-Apr-08 0:10 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy29-Apr-08 2:55
Blue_Boy29-Apr-08 2:55 
AnswerRe: Selecting 3 columns and merging??? Pin
Karan_TN29-Apr-08 21:39
Karan_TN29-Apr-08 21:39 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy29-Apr-08 21:41
Blue_Boy29-Apr-08 21:41 
GeneralRe: Selecting 3 columns and merging??? Pin
Karan_TN1-May-08 22:44
Karan_TN1-May-08 22:44 
GeneralRe: Selecting 3 columns and merging??? Pin
Blue_Boy1-May-08 23:40
Blue_Boy1-May-08 23:40 
QuestionSql Server Security Pin
~V~28-Apr-08 21:25
~V~28-Apr-08 21:25 
GeneralRe: Sql Server Security Pin
Blue_Boy28-Apr-08 21:49
Blue_Boy28-Apr-08 21:49 
GeneralRe: Sql Server Security Pin
GuyThiebaut28-Apr-08 22:28
professionalGuyThiebaut28-Apr-08 22:28 
GeneralRe: Sql Server Security Pin
~V~28-Apr-08 23:16
~V~28-Apr-08 23:16 
GeneralStoring files in a field of type image ??? [modified] Pin
devboycpp28-Apr-08 20:37
devboycpp28-Apr-08 20:37 
GeneralSum the top 2 records Pin
Broken Bokken28-Apr-08 12:30
Broken Bokken28-Apr-08 12:30 
GeneralRe: Sum the top 2 records Pin
Harini N K28-Apr-08 19:48
Harini N K28-Apr-08 19:48 
GeneralRe: Sum the top 2 records Pin
WoutL28-Apr-08 23:24
WoutL28-Apr-08 23:24 
GeneralRe: Sum the top 2 records Pin
Broken Bokken29-Apr-08 2:06
Broken Bokken29-Apr-08 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.