SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Get distinct combine non distinct
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

infodemers
Posting Yak Master

Canada
181 Posts

Posted - 06/18/2013 :  14:29:28  Show Profile  Reply with Quote
Hi ,

I wish to create a table that include a distinct list of Office from a table and add to each of them, a row with a value between 0800 to 2300. sor for every single office , I would have 16 records(rows).

Office | Hour
_____________
ABCD 0800
ABCD 0900
. .
. .
ABCD 2300
KLMN 0800
KLMN 0900 etc...

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 06/18/2013 :  14:45:18  Show Profile  Reply with Quote
One way is to create a table (temp or permanent or table var or derived or cte) with your 16 rows. Then CROSS JOIN that in a select statement to your Office table. That would result in 16 rows for every office.

Be One with the Optimizer
TG
Go to Top of Page

infodemers
Posting Yak Master

Canada
181 Posts

Posted - 06/18/2013 :  16:10:25  Show Profile  Reply with Quote
I thank you very much, that did the trick using temp table! :-)
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 06/18/2013 :  16:34:44  Show Profile  Reply with Quote
You're welcome! - thanks for the update.

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000