You are here:   Home
Register   |  Login
ThinkStock

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
Enroll in home water delivery today!

Recent Comments

Minimize
Re: Three Benefits to Using a Royalty-Free Image on Your Website or Blog
I also prefer to use royalty-free images. They give more credibility in your site or blog posts.
Re: Websites vs. Facebook Pages (Infographic)
Internet can be very useful for small business to market them self, there is always some free way to reach your audience via Internet.
Re: Is Keyword Density Still Important For On Page SEO
The search engines hadn’t quite caught up yet. As a result, it wasn’t uncommon to see sites rank highly when their content read something like this.that they follow SEO best practices than you will by trying to figure out a way to get your keywords into your page content another one or two times.
Re: Websites vs. Facebook Pages (Infographic)
Very interesting topic, infographics was a new concept for me, will definitely use it.
Re: Reducing Small Business Blues
Running a business is tough and you are right, most of the time you are the core aspect of each area of a business. I don't think I could handle doing my own accounting, like you I am too terrible with numbers!

u comment, i follow