« first day (3719 days earlier)      last day (1150 days later) » 

7:43 AM
Morning
 
8:14 AM
Morning
 
9:07 AM
0
A: select number that isn't in the table

Yvalson DronkersI actually got quite good fix for my problem using the following code: $randnum = rand(1, 50); $query = mysql_query("SELECT Stoelnummer FROM reserveringen WHERE Voorstellingsnummer = '$Voorstellingsnummer' AND Stoelnummer = '$randnum'", $db); while(mysql_num_rows($query) == 1){ ...

mind blown
 
 
1 hour later…
10:23 AM
Hello [SQL-server]

I'm able to get a tally table for 5 days using level field :
WITH cte AS (
         SELECT CAST('2021-03-01' AS DATE) AS a,
                0 AS LEVEL


         union ALL
         SELECT DATEADD(DAY, 1, a),
                LEVEL + 1 AS LEVEL
         FROM   cte
         WHERE  LEVEL < 4
     )

	 SELECT * FROM cte
but I tried without level :
WITH cte AS (
         SELECT CAST('2021-03-01' AS DATE) AS a


         union ALL
         SELECT DATEADD(DAY, 1, a)
         FROM   cte
         WHERE  DATEADD(DAY, 1, a) < GETDATE()
     )

SELECT *
FROM   cte
oh shi*... it also works.
I don't know why it didn't work before
sorry
 
 
1 hour later…
11:27 AM
Morning
 
12:10 PM
@RoyiNamir maybe you forgot those pesky terminators
SQL Server is ok with missing them most of the time but not for some specific cases, i.e. before a CTE.
 
 
2 hours later…
2:29 PM
Good morning
 

« first day (3719 days earlier)      last day (1150 days later) »