You are here:   Home
Register   |  Login
Dealster - Local Deals

Captured Technology - Blog

Minimize

Selecting the Top 2 Meeting Dates from Separate Records

Jun 22

Written by:
6/22/2009 4:26 PM  RssIcon

Selecting the Top 2 Meeting Dates from Separate Records

I wrote this short SQL Server code today to select the top 2 meeting dates and combine them into a single record. Using a temporary table it was possible to select the first date as one column and then select the second date as a second column. These records will be placed into a grid with the first record representing meeting dates and the second record showing agendas. Therefore the Union All was used to duplicate the first record.

--Drop Table #TempTable 

Select Top 2 meeting_date
Into  #TempTable 
From meeting_dates_table
Where published_date <= getdate()
Order By meeting_date Desc

Select (Select Top 1 meeting_date From #TempTable) As date1, (Select Top 1  meeting_date From #TempTable Order By meeting_date Asc) As date2
Union All
Select (Select Top 1 meeting_date From #TempTable) As date1, (Select Top 1  meeting_date From #TempTable Order By meeting_date Asc) As date2

Tags:
Categories:

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 

FaceBook

Minimize

Mobile Version

Minimize
Add CapturedTech - Technology Mippin widget

Translate

Minimize

Sponsors

Minimize
Call Now: 877-672-3078

Recent Comments

Minimize
Re: Microsoft Test Bounties
I had spent a good deal of my time looking for someone to explain this subject clearly and I have really enjoyed reading your blog posts and I collected a lot of interesting things as well as I done a research on the subject and learn most peoples will agree with your blog.
Re: 10 Ways to Source Great Sales Leads
Hoovers.com, that have contact information for tens of millions of businesses. If necessary, you can work with these companies' research teams to order lists specifically tailored to your organization's sales needs.
Re: Microsoft Test Bounties
To find bugs and showing it to microsoft is quite admirable. Keep blogging more i will appreciate.
Re: Microsoft Test Bounties
Testing a software and giving out the errors to microsoft is amazing. Very good thing to do. One can do this in free time.
Re: Reindexing SQL Server Tables
Discussed about the SQL server and more interesting matter discussed in the post because in the post define about the SQL server table so that can be know that and able to understand regarding post.

u comment, i follow