WITH given_numbers AS (
SELECT unnest(ARRAY[101, 102, 104, 106, 110, 120, 121, 122, 123, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 150, 151, 210, 211, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
234, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 260, 261, 560, 561, 562,
563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 580, 581, 582,
583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 610, 611, 612, 613, 614, 620,
621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 640, 641,
642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660,
661, 662, 670, 671, 680, 681, 682, 683, 684, 690, 691, 692, 693, 730, 731, 732, 734, 738, 740,
741, 743, 744, 760, 761, 762, 763, 764, 851, 853, 854, 855, 856, 857, 860, 864, 865, 866, 867,
870, 871, 872, 873, 874, 875, 876, 877, 878, 880, 881, 882, 883, 884, 885, 890, 891, 892, 893,
894, 895, 930, 931, 932, 933, 934, 935, 936, 937, 940, 941, 942, 943, 944, 945, 946, 947, 990,
991, 995, 996]) AS fahrzeugnummer
)
SELECT DISTINCT f.fahrzeugnummer
FROM public.fahrten f
WHERE f.fahrzeugnummer >= 100 AND f.fahrzeugnummer < 1000
AND f.fahrzeugnummer NOT IN (SELECT fahrzeugnummer FROM given_numbers)
ORDER BY f.fahrzeugnummer;
My other project https://github.com/Public-Transport-Nuremberg/VAGStatsTracker did observe the 41 following busses but they are not in the list, any 3 number bus should be a VAG Bus.
152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289
This can be checked with a single SQL Query: