Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server Newbies
»
Generating Combination Numbers
Generating Combination Numbers
Rate Topic
Display Mode
Topic Options
Author
Message
varunfilim
varunfilim
Posted Thursday, July 29, 2010 1:01 AM
SSC Rookie
Group: General Forum Members
Last Login: Sunday, December 19, 2010 10:52 PM
Points: 30,
Visits: 213
Hi friends,
I have a scenario where the table values are
ID First Second
1 6 2
1 4 2
1 2 2
2 6 1
2 4 1
2 2 1
From this table I want to generate a combination where Next ID values is max(previous ID) ie 3 and a combination of first and second which didnt come in the Previous combination, for eg
3 6 2
3 4 1
3 2 2
Can any solve this issue...help appreciated...
Post #960522
Cadavre
Cadavre
Posted Thursday, July 29, 2010 3:11 AM
SSCrazy
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:16 AM
Points: 2,236,
Visits: 6,486
varunfilim (7/29/2010)
Hi friends,
I have a scenario where the table values are
ID First Second
1 6 2
1 4 2
1 2 2
2 6 1
2 4 1
2 2 1
From this table I want to generate a combination where Next ID values is max(previous ID) ie 3 and a combination of first and second which didnt come in the Previous combination, for eg
3 6 2
3 4 1
3 2 2
Can any solve this issue...help appreciated...
Umm, why not: -
3 6 2
3 4 2
3 2 2
??
Just want to understand the actual requirement before I spend some time.
Not a DBA, just trying to learn
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better, quicker answers on SQL Server performance related questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
If you litter your database queries with nolock query hints, are you aware of the side effects?
Try reading a few of these links...
(*)
Missing rows with nolock
(*)
Allocation order scans with nolock
(*)
Consistency issues with nolock
(*)
Transient Corruption Errors in SQL Server error log caused by nolock
(*)
Dirty reads, read errors, reading rows twice and missing rows with nolock
LinkedIn
| Blog coming soon (for sufficiently large values of "soon"
)!
Post #960564
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
Posted Thursday, July 29, 2010 3:21 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 8:31 AM
Points: 3,129,
Visits: 4,312
Please provide the DDL for the tables and examples that you have already tried
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #960568
dinesh.spn
dinesh.spn
Posted Thursday, April 28, 2011 4:30 AM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 1:16 PM
Points: 7,
Visits: 120
Hi,
I Have similar requirement. If anyone solve this, pls let me know. Explanation of the problem.
Consider i have two columns with combinations of numbers. I want to pick the genuine combinations of numbers which doesnt involve in other valid conbinations. For ex.,
Num1 Num2
6 2
2 1
2 3
4 6
3 1
8 9
3 9
6 8
My result should be
6 2
3 1
8 9
Can this be done without using loops...
Post #1100095
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.