| bio | website | |
|---|---|---|
| location | Ukraine | |
| age | ||
| visits | member for | 1 year, 3 months |
| seen | yesterday | |
| stats | profile views | 39 |
|
May 19 |
awarded | Caucus |
|
Mar 20 |
comment |
Performance about this simplified where-condition query This would seem more on topic on Database Administrators. Voting to migrate. |
|
Mar 19 |
revised |
Find “n” consecutive free numbers from table added one more demo link, change the other one to use the version 9.1.8, added a note |
|
Mar 19 |
revised |
Find “n” consecutive free numbers from table expanded in response to the question's update |
|
Mar 18 |
revised |
Find “n” consecutive free numbers from table added 44 characters in body |
|
Mar 18 |
comment |
Find “n” consecutive free numbers from table @boobiq: Do you want one per id_set or just one? Please update your question if this was meant as its part from the beginning. (So that others can see the full requirements and offer their suggestions or update their answers.) |
|
Mar 18 |
revised |
Find “n” consecutive free numbers from table clarified |
|
Mar 18 |
comment |
Find “n” consecutive free numbers from table I can see no problem with that. The appearance of the data sample very clearly suggests that the numbers are unique and consecutive. If they aren't what they seem then it's the OP's responsibility to make sure we are not deceived by the looks of things, even though it is never a bad idea to spell out your assumptions (which you did). So, I will still say this is a nice solution for a specific design. |
|
Mar 18 |
comment |
Find “n” consecutive free numbers from table No window functions, very nice! Although I think it should be M.number-consec+1 (e.g. for 10 it would need to be 10-3+1=8). |
|
Mar 18 |
answered | Find “n” consecutive free numbers from table |
|
Mar 18 |
comment |
Issue with ROW_NUMBER and DISTINCT This demo doesn't show any difference. What am I missing? |
|
Mar 18 |
comment |
Issue with ROW_NUMBER and DISTINCT For one thing, the TOP in the query you've posted is unreliable, because it is not accompanied with an ORDER BY. However, have you tried this? The TOP wouldn't affect the results, although if you insist, you can just add it in at the same level as in your query. |
|
Mar 18 |
answered | Issue with ROW_NUMBER and DISTINCT |
|
Mar 18 |
comment |
Issue with ROW_NUMBER and DISTINCT Which ID should go with each distinct Dept? And do you need the IDs to begin with? |
|
Mar 18 |
awarded | Citizen Patrol |
|
Mar 15 |
revised |
Update a table field with another table field added additional information from the comments, improved formatting, made table names more consistent |
|
Mar 15 |
suggested | suggested edit on Update a table field with another table field |
|
Mar 15 |
comment |
Update a table field with another table field Right. Will you tell us which column in table_3 can be used to link to table_2? Or should we guess? :) |
|
Mar 15 |
comment |
Update a table field with another table field In order to use a third table to link the first two, the third table must have common columns with both of the other two tables. It is not enough if it can be linked to just one of them. |
|
Mar 15 |
comment |
Update a table field with another table field ‘I am trying something like this:’ – something like what? Did you remove your attempted query accidentally or intentionally? |