← Back to Blog

SQL for Lottery Analysis, Part 4: Same Number, Many States

December 2, 2026  ·  9 min read  ·  Education

SQL for Lottery Analysis series

  1. Part 1: Count how often each number is drawn
  2. Part 2: Find "overdue" numbers with window functions
  3. Part 3: Measure jackpot rollover streaks
  4. Part 4: Same number, same day, different states (you are here)
  5. Part 5: Test it all: why none of it predicts a draw

Free practice data: SQLite database · Powerball CSV · Pick 3/Pick 4 CSV

Here's a question that comes up whenever two states draw the same Pick 3 number on the same day: how unusual is that? This part answers it with a year of real results, using the pick_draws table in the sample database (or the Pick 3/Pick 4 CSV). Along the way it covers HAVING, GROUP_CONCAT and joining a table to itself.

Step 1: Look at the table

Each row is one draw of a Pick 3 or Pick 4 style game in 2025. The number column holds the digits as text, so 073 keeps its leading zero, and digits is 3 or 4.

SELECT digits,
       COUNT(*) AS draws,
       COUNT(DISTINCT state) AS states,
       COUNT(DISTINCT draw_date) AS days
FROM pick_draws
GROUP BY digits;

Result:

digitsdrawsstatesdays
32578137365
42517534365

That's 25,781 three-digit draws and 25,175 four-digit draws. Many games draw more than once a day. In the table, Texas has four draws a day, six days a week. Here's one day in four big states:

SELECT state, game, draw_time, number
FROM pick_draws
WHERE digits = 3
  AND draw_date = '2025-07-04'
  AND state IN ('FL', 'NY', 'OH', 'TX')
ORDER BY state, draw_time;

Result:

stategamedraw_timenumber
FLPick 3evening260
FLPick 3midday620
NYNumbersevening965
NYNumbersmidday569
OHPick 3evening635
OHPick 3midday998
TXPick 3day774
TXPick 3evening207
TXPick 3morning857
TXPick 3night431

Maine, New Hampshire and Vermont sell Pick 3 and Pick 4 through their joint Tri-State Lottery (Wikipedia), and in our records the three states' results are identical. The table keeps each of those drawings once, under ME/NH/VT. Otherwise every shared drawing would look like three states matching.

Step 2: Find numbers drawn in two or more states on one day

Group by date and number, then count the different states in each group. WHERE can't filter on a count, because the count doesn't exist until the rows are grouped. HAVING is the filter that runs after grouping. GROUP_CONCAT joins the matching states into one text value.

SELECT draw_date,
       number,
       COUNT(DISTINCT state) AS states,
       GROUP_CONCAT(DISTINCT state) AS which_states
FROM pick_draws
WHERE digits = 3
GROUP BY draw_date, number
HAVING COUNT(DISTINCT state) >= 2
ORDER BY states DESC, draw_date
LIMIT 10;

Result:

draw_datenumberstateswhich_states
2025-01-035283DE,OK,VA
2025-01-092533DC,MD,NC
2025-01-190933MI,VA,WI
2025-01-212773DC,DE,GA
2025-02-156853NM,SC,TN
2025-03-041853CO,IL,MS
2025-03-107533CT,TN,WI
2025-04-048383CO,CT,LA
2025-04-086013IA,MI,NE
2025-04-086643FL,NC,WV

On January 9, 2025, for example, 253 was drawn in the District of Columbia, Maryland and North Carolina. A match counts if it happened at any time that day, so one state's midday draw can match another's evening draw.

Step 3: How often does it happen?

WITH by_number AS (
  SELECT draw_date, number, COUNT(DISTINCT state) AS states
  FROM pick_draws
  WHERE digits = 3
  GROUP BY draw_date, number
)
SELECT states AS states_drawing_it, COUNT(*) AS date_number_combos
FROM by_number
GROUP BY states
ORDER BY states;

Result:

states_drawing_itdate_number_combos
123957
2870
325
WITH shared AS (
  SELECT draw_date
  FROM pick_draws
  WHERE digits = 3
  GROUP BY draw_date, number
  HAVING COUNT(DISTINCT state) >= 2
)
SELECT COUNT(DISTINCT draw_date) AS days_with_a_match,
       (SELECT COUNT(DISTINCT draw_date) FROM pick_draws WHERE digits = 3) AS days
FROM shared;

Result:

days_with_a_matchdays
338365

In 2025 a three-digit number came up in two states on the same day 870 times, and in three states 25 times. No number came up in four states on one day. At least one match happened on 338 of the 365 days.

Step 4: Is that more than chance?

It sounds like a lot, until you count the chances. With about 71 Pick 3 draws a day across the country, there are thousands of ways to pair up two draws from different states each day. Any one pair matches with a chance of 1 in 1,000, since there are 1,000 possible three-digit numbers. This is the same idea as the birthday problem (Wikipedia): in a group of just 23 people, two probably share a birthday, because there are so many pairs.

SQL can count the pairs. The per_day step counts each state's draws per day, and multiplying two states' counts gives the number of draw pairs between them. The matches step joins pick_draws to itself, a self join: every draw is compared with every draw from another state on the same date, and b.state > a.state makes sure each pair is counted once.

WITH per_day AS (
  SELECT draw_date, state, COUNT(*) AS draws
  FROM pick_draws
  WHERE digits = 3
  GROUP BY draw_date, state
),
pairs AS (
  SELECT SUM(a.draws * b.draws) AS draw_pairs
  FROM per_day AS a
  JOIN per_day AS b
    ON b.draw_date = a.draw_date
   AND b.state > a.state
),
matches AS (
  SELECT COUNT(*) AS matching_pairs
  FROM pick_draws AS a
  JOIN pick_draws AS b
    ON b.draw_date = a.draw_date
   AND b.digits = a.digits
   AND b.state > a.state
   AND b.number = a.number
  WHERE a.digits = 3
)
SELECT draw_pairs,
       ROUND(draw_pairs / 1000.0, 1) AS expected_matches,
       matching_pairs AS actual_matches
FROM pairs, matches;

Result:

draw_pairsexpected_matchesactual_matches
885081885.1945

Chance predicts 885.1 matching pairs across the year, and the data has 945. (A number drawn in three states counts as three pairs, which is why this figure is higher than the Step 3 count.) Treating each pair as an independent 1 in 1,000 chance, random variation of about ±60 either way (two standard deviations) is normal, and 945 sits right at that edge. A result this far above chance or further turns up by luck about once in 42 years of draws like these, so it's unusual but not remarkable. Looking closer doesn't point to a link between states: the matches are spread across hundreds of state pairs and dates rather than piling up between a few states. Pick 4 has 10,000 possible numbers, so matches should be 10 times rarer:

WITH per_day AS (
  SELECT draw_date, state, COUNT(*) AS draws
  FROM pick_draws
  WHERE digits = 4
  GROUP BY draw_date, state
),
pairs AS (
  SELECT SUM(a.draws * b.draws) AS draw_pairs
  FROM per_day AS a
  JOIN per_day AS b
    ON b.draw_date = a.draw_date
   AND b.state > a.state
),
matches AS (
  SELECT COUNT(*) AS matching_pairs
  FROM pick_draws AS a
  JOIN pick_draws AS b
    ON b.draw_date = a.draw_date
   AND b.digits = a.digits
   AND b.state > a.state
   AND b.number = a.number
  WHERE a.digits = 4
)
SELECT draw_pairs,
       ROUND(draw_pairs / 10000.0, 1) AS expected_matches,
       matching_pairs AS actual_matches
FROM pairs, matches;

Result:

draw_pairsexpected_matchesactual_matches
84125384.178

Chance predicts 84.1 and the data has 78, a little under chance and well within ordinary variation. The same number in several states on one day is a coincidence that happens nearly every day, at about the rate the odds say it should. It doesn't connect the drawings, and it doesn't make the number more or less likely next time.

Known gaps in this table

The table holds every 2025 draw in our database. Not every slot has 365 draws: several games, Texas among them, skip Sunday draws, and Nebraska Pick 4 starts on September 21, 2025, the day the game launched (Lottery.net). A few individual draws are missing too. The expected counts in Step 4 are built from the draws actually in the table, so the comparison is still fair. Checking counts per group like this before trusting a total is a good habit with any real data.

Try it yourself

About the practice data

The sample files come from the DrawAnalytics results database, the same records behind our Powerball pages and state results pages. They're free to use; if you publish something made with them, please credit DrawAnalytics with a link.

Two things are worth knowing. The jackpot column is the jackpot advertised for each draw; for a draw where the jackpot was won, it's the amount the lottery announced, which can be a little higher than the estimate before the draw. And a few individual draws in our database have been wrong before, so for anything that matters, such as checking a ticket, use the lottery's official results. Powerball's are at powerball.com. Developers who want more data can use our free results API.

Next: Part 5: Test it all: why none of it predicts a draw

Sources

DrawAnalytics is an informational service. We do not sell predictions or guarantee outcomes. Lottery drawings are random — past results do not predict future drawings. Play responsibly. 1-800-GAMBLER.

Need to talk to someone about gambling?

Free, confidential help is available 24/7. Call or text 1-800-GAMBLER (1-800-426-2537) or visit ncpgambling.org.

DrawAnalytics is an informational and entertainment service. We provide historical lottery data analysis and pattern exploration tools. We do not sell predictions, we do not guarantee any outcome, and we make no representation that any tool on this site improves a user's probability of winning any lottery game. Lottery drawings are random. Past results do not predict future drawings. DrawAnalytics is independent and is not affiliated with or endorsed by any state lottery, the Multi-State Lottery Association, Powerball or Mega Millions. Game names are trademarks of their respective owners. Results are collected from public sources and may contain errors; official lottery results prevail. You must be 18 or older (21+ in some states) to play state lottery games. If you or someone you know has a gambling problem, call 1-800-GAMBLER or visit ncpgambling.org.