Categories
Mastering Development

How to format ids for a SQL query (need quotes around and commas in between)

I have a list of IDs that I want to put in a SELECT query such as

id in ('1','2','3'...etc)

The list is:

32563 32653 32741 33213 539489 546607 546608 546608 547768 1160546 1200461 1202015 1202762 1203537 1203931 1204392 1204393 1204416 1204719 1204819 1205057 1205095 1205168 1206028 1206186 1206224 1227189 1302636 1316358 1336567 1360386 1378275 1378275 1379361 1380689 1380761 1380994 1484999 1488199 1491348 1496272 1496423 1496462 1501335 1501607 1503495 1508220 1508232 1508234 1508353 1508354 1508355 1508356 1517247 1517497 1521774 1521774 1521887 1521899 1522718 1522741 1522884 1522886 1522898 1522933 1522942 1522954 1522972 1522976 1522987 1523167 1523195 1523265 1523285 1523314 1523343 1523379 1523454 1523474 1523475 1523634 1523683 1523930 1523933 1524006 1524007 1524015 1524016 1524017 1524019 1524020 1524021 1524022 1524023 1524024 1524025 1524026 1524027 1524028 1524029 1524031 1524032 1524033 1524034 1524035 1524036 1524037 1524038 1524039 1524040 1524041 1524042 1524043 1524062 1524063 1524064 1524065 1524066 1524067 1524068 1524070 1524071 1524072 1524073 1524074 1524076 1524077 1524078 1524103 1524104 1524106 1524107 1524108 1524109 1524124 1524126 1524127 1524128 1524129 1524131 1524132 1524133 1524134 1524135 1524136 1524137 1524149 1524150 1524151 1524152 1524153 1524157 1524171 1524171 1524182 1524185 1524192 1524193 1540474 1540480 1540482 1540488 1540496 1540500 1540501 1540502 1540507 1540516 1541267 1542298 1542403 1560206 1561411 1561412 1561447 1561509 1563538 1564021 1564090 1564107 1564129 1564178 1564180 1564183 1564187 1564327 1564328 1564332 1564362 1564363 1564436 1564437 1564438 1564476 1564478 1564505 1564506 1564738 1564740 1564743 1564752 1564834 1565680 1567008 1567771 1567795 1569848 1572376 1574699 1574701 1736603 1887791 1888069 1888070 1888072 1888073 1888077 1888084 1888085 1888094 1888109 1888110 1888111 1888112 1888113 1888114 1888115 1888116 1888117 1888118 1888122 1888123 1888124 1888125 1888128 1888129 1888136 1888137 1888138 1888144 1888151 1888155 1888161 1888163 1888172 1888173 1888174 1888175 1888176 1888177 1888178 1888183 1888186 1888187 1888192 1888193 1888194 1888195 1888196 1888197 1888198 1888199 1888202 1888203 1888204 1888205 1888214 1888216 1888220 1888221 1888229 1888236 1888238 1888240 1888245 1888246 1888262 1888272 1888286 1888287 1888288 1888290 1888291 1888292 1888294 1888295 1888296 1888297 1888298 1888299 1888301 1888302 1888317 1888318 1888424 1888819 1888832 1888843 1888845 1888854 1888857 1888858 1888873 1888874 1888875 1888876 1888882 1888883 1888884 1888947 1888948 1888949 1888950 1888955 1888956 1888957 1888958 1888959 1888960 1888961 1888962 1888963 1888964 1888965 1888969 1888970 1888971 1888972 1888973 1888974 1888975 1888976 1888977 1888978 1888979 1888980 1888981 1888982 1888983 1888984 1888985 1888986 1888987 1888988 1888989 1888990 1888991 1888992 1888993 1888994 1888995 1888996 1888997 1888998 1888999 1889000 1889001 1889002 1889003 1889003 1889004 1889005 1889006 1889007 1889008 1889010 1889011 1889012 1889013 1889014 1889015 1889016 1889017 1889018 1889019 1889020 1889022 1889023 1889024 1889025 1889026 1889027 1889028 1889029 1889030 1889039 1889040 1889042 1889043 1889044 1889045 1889046 1889047 1889048 1889049 1889050 1889057 1889070 1889074 1889084 1889089 1889090 1889091 1889092 1889093 1889094 1889095 1889101 1889106 1889107 1889111 1889112 1889113 1889114 1889114 1889115 1889116 1889117 1889118 1889119 1889120 1889121 1889122 1889123 1889124 1889125 1889126 1889127 1889128 1889129 1889147 1889148 1889151 1889152 1889152 1889153 1889154 1889155 1889156 1889157 1889158 1889159 1889160 1889161 1889162 1889163 1889164 1889165 1889166 1889168 1889169 1889170 1889176 1889177 1889180 1889183 1889184 1889185 1889186 1889187 1889188 1889189 1889190 1889191 1889192 1889195 1889196 1889197 1889198 1889199 1889200 1889201 1889202 1889203 1889204 1889205 1889206 1889207 1889208 1889209 1889210 1889211 1889212 1889213 1889214 1889215 1889216 1889217 1889218 1889219 1889220 1889221 1889222 1889223 1889224 1889225 1889226 1889227 1889228 1889229 1889230 1889231 1889232 1889233 1889234 1889235 1889237 1889238 1889239 1889240 1889241 1889242 1889243 1889244 1889245 1889246 1889251 1889252 1889253 1889254 1889255 1889256 1889257 1889258 1889259 1889260 1889262 1889263 1889264 1889266 1889267 1889268 1889269 1889270 1889271 1889272 1889273 1889274 1889275 1889276 1889277 1889278 1889279 1889280 1889283 1889284 1889285 1889286 1889288 1889289 1889290 1889291 1889292 1889293 1889294 1889295 1889296 1889297 1889298 1889299 1889300 1889301 1889302 1889303 1889304 1889305 1889306 1889307 1889309 1889310 1889311 1889312 1889313 1889314 1889315 1889316 1889317 1889318 1889319 1889320 1889321 1889322 1889323 1889324 1889325 1889326 1889327 1889328 1889329 1889330 1889331 1889332 1889333 1889334 1889335 1889336 1889337 1889338 1889339 1889340 1889341 1889342 1889343 1889344 1889345 1889346 1889347 1889348 1889349 1889350 1889351 1889352 1889353 1889354 1889355 1889357 1889358 1889359 1889360 1889361 1889362 1889363 1889364 1889365 1889366 1889367 1889368 1889369 1889370 1889371 1889372 1889373 1889374 1889375 1889376 1889377 1889378 1889379 1889380 1889381 1889382 1889383 1889384 1889385 1889386 1889387 1889388 1889389 1889390 1889391 1889392 1889393 1889394 1889395 1889396 1889397 1889398 1889399 1889400 1889401 1889403 1889404 1889405 1889406 1889407 1889408 1889409 1889410 1889411 1889412 1889413 1889414 1889415 1889416 1889417 1889418 1889419 1889420 1889421 1889422 1889423 1889424 1889425 1889426 1889427 1889428 1889429 1889430 1889431 1889432 1889433 1889434 1889435 1889436 1889437 1889438 1889439 1889440 1889441 1889442 1889443 1889444 1889445 1889446 1889447 1889448 1889449 1889450 1889451 1889452 1889453 1889454 1889455 1889456 1889457 1889459 1889462 1889463 1889464 1889465 1889466 1889467 1889468 1889469 1889470 1889471 1889472 1889473 1889474 1889475 1889476 1889477 1889478 1889479 1889481 1889482 1889483 1889484 1889485 1889486 1889487 1889488 1889490 1889491 1889492 1889493 1889494 1889495 1889496 1889498 1889499 1889500 1889501 1889502 1889503 1889504 1889505 1889506 1889507 1889508 1889510 1889511 1889512 1889513 1889514 1889515 1889516 1889517 1889518 1889520 1889521 1889522 1889525 1889526 1889527 1889528 1889529 1889530 1889531 1889534 1889535 1889536 1889537 1889538 1889539 1889540 1889541 1889542 1889543 1889544 1889547 1889548 1889549 1889550 1889551 1889552 1889555 1889556 1889557 1889558 1889559 1889560 1889561 1889562 1889563 1889564 1889565 1889566 1889567 1889568 1889569 1889570 1889571 1889572 1889573 1889574 1889575 1889576 1889577 1889578 1889579 1889580 1889581 1889582 1889583 1889584 1889585 1889586 1889587 1889588 1889589 1889590 1889592 1889593 1889594 1889595 1889596 1889597 1889598 1889599 1889600 1889603 1889604 1889605 1889606 1889607 1889608 1889609 1889610 1889611 1889612 1889613 1889614 1889615 1889616 1889617 1889618 1889619 1889620 1889621 1889622 1889623 1889624 1889625 1889626 1889627 1889628 1889629 1889630 1889631 1889632 1889633 1889634 1889635 1889636 1889637 1889638 1889639 1889640 1889641 1889642 1889643 1889644 1889645 1889646 1889647 1889648 1889649 1889650 1889651 1889652 1889653 1889654 1889655 1889656 1889657 1889658 1889659 1889660 1889661 1889662 1889663 1889664 1889665 1889666 1889669 1889670 1889671 1889672 1889674 1889675 1889676 1889677 1889680 1889681 1889682 1889683 1889684 1889685 1889686 1889687 1889688 1889689 1889690 1889691 1889692 1889693 1889694 1889695 1889697 1889698 1889699 1889700 1889701 1889702 1889703 1889704 1889713 1889715 1889716 1889717 1889718 1889719 1889720 1889721 1889722 1889727 1889728 1889729 1889730 1889732 1889733 1889734 1889735 1889736 1889737 1889738 1889739 1889740 1889741 1889742 1889743 1889754 1889755 1889756 1889757 1889758 1889759 1889761 1889762 1889763 1889764 1889765 1889766 1889767 1889768 1889769 1889770 1889771 1889772 1889773 1889774 1889775 1889776 1889777 1889778 1889779 1889780 1889781 1889782 1889783 1889784 1889785 1889786 1889787 1889788 1889789 1889795 1889796 1889797 1889799 1889800 1889801 1889802 1889803 1889804 1889805 1889806 1889807 1889808 1889809 1889810 1889811 1889812 1889813 1889814 1889815 1889816 1889817 1889818 1889819 1889820 1889821 1889822 1889823 1889824 1889825 1889828 1889829 1889830 1889831 1889833 1889834 1889835 1889836 1889837 1889838 1889841 1889842 1889843 1889844 1889845 1889846 1889847 1889848 1889849 1889852 1889853 1889854 1889855 1889861 1889863 1889867 1889877 1889878 1889880 1889911 1889937 1889942 1889944 1889946 1889947 1889948 1889949 1889950 1889951 1889973 1889991 1890046 1890108 1890160 1890557 1890560 1890566 1890571 1891843 1891879 1891891 1893385 1893501 1895226 1895290 1895701 1895775 1896090 1896098 1896100 1897648 1897656 1897670 1897737 1898633 1898900 1898900 1898923 1898925 1898931 1898935 1898937 1898948 1899048 1899052 1899080 1899108 1899316 1899318 1899320 1899322 1899324 1899326 1899328 1899328 1899330 1899330 1899332 1899334 1899336 1899346 1899348 1899348 1899350 1899350 1899352 1899769 1901376 2225469 2228253 2228257 2228259 2228260 2228263 2228266 2228268 2228269 2228280 2228281 2236208 2236224 2236334 2239477 2239553 2240951 2252045 2252185 2252698 2252722 2252785 2252786 2252787 2252788 2252789 2252790 2252791 2252792 2252793 2252794 2252795 2252796 2252797 2252798 2252799 2252800 2252801 2252802 2252803 2252804 2252805 2252806 2252807 2252808 2252809 2252831 2252832 2252833 2252834 2252835 2252836 2252837 2252838 2252839 2252840 2252841 2252842 2252843 2252844 2252845 2252846 2252847 2252848 2252849 2252850 2252851 2252852 2252853 2252854 2252855 2252856 2252857 2252858 2252859 2252860 2252861 2252862 2252863 2252864 2252865 2252866 2252867 2252868 2252869 2252870 2252871 2252872 2252873 2252874 2252875 2252876 2252877 2252878 2252879 2252880 2252881 2252882 2252883 2252884 2252885 2252886 2252887 2252888 2252889 2252890 2252891 2252892 2252893 2252894 2252895 2252896 2252897 2252898 2252899 2252900 2252901 2252902 2252903 2252904 2252905 2252906 2252907 2252908 2252909 2252910 2252911 2252912 2252913 2252914 2252915 2252916 2252917 2252918 2252919 2252920 2252921 2252922 2252923 2252924 2252925 2252926 2252927 2252928 2252929 2252930 2252931 2252932 2252933 2252934 2252935 2252936 2252937 2252938 2252939 2252940 2252941 2252942 2252943 2252944 2252945 2252946 2252947 2252948 2253447 2253638 2253821 2255169 2256953 2256958 2260012 2260089 2261158 2261178 2261186 2261190 2261194 2261195 2261199 2261201 2266541 2266547 2266553 2269605 2269606 2269607 2269608 2269609 2269610 2269611 2269612 2269613 2269614 2269614 2269615 2269615 2269616 2269616 2269617 2269617 2269618 2269619 2269620 2269620 2269621 2269621 2269622 2269623 2269623 2269624 2269624 2269625 2269625 2269626 2269626 2269627 2269628 2269629 2269629 2269630 2269631 2269632 2269633 2269634 2269635 2269636 2269637 2269638 2269639 2269640 2269640 2269641 2269642 2269643 2269644 2269645 2269646 2269647 2269648 2269649 2269650 2269651 2269652 2269653 2269654 2269655 2269656 2269657 2269658 2269659 2269660 2269661 2269662 2269663 2269663 2269664 2269664 2269665 2269666 2269667 2269668 2269669 2269669 2269670 2269670 2269671 2269671 2269672 2269672 2269673 2269673 2269674 2269674 2269675 2269676 2269677 2269678 2269679 2269680 2269681 2269682 2269683 2269684 2269684 2269685 2269685 2269686 2269686 2269687 2269687 2269688 2269688 2269689 2269689 2269690 2269690 2269691 2269691 2269692 2269692 2269693 2269693 2269694 2269695 2269695 2269696 2269696 2269697 2269698 2269698 2269699 2269699 2269700 2269700 2269701 2270733 2270734 2270735 2270736 2270737 2270738 2270739 2270740 2270741 2270742 2270743 2270744 2270745 2270746 2270747 2270748 2270749 2270750 2270751 2270752 2270753 2270754 2270755 2270756 2270757 2270758 2270759 2270760 2270761 2270762 2270763 2270764 2270765 2270766 2270767 2270768 2270769 2270770 2270771 2270772 2270773 2270774 2270775 2270776 2270777 2270778 2270779 2270780 2270781 2270782 2270783 2270784 2270785 2270786 2270787 2270788 2270789 2270790 2270791 2270792 2270793 2270794 2270795 2270796 2270797 2270798 2270799 2270800 2270801 2270802 2270803 2270804 2270805 2270806 2270807 2270808 2270809 2270810 2270811 2270812 2270813 2270814 2270815 2270816 2270817 2270818 2270819 2270820 2270821 2270822 2270823 2270824 2270825 2270826 2270827 2270828 2270829

As you can tell, there are more than a thousand. How do I format these ids to make them work for my id in ('x','y') query ?

Leave a Reply

Your email address will not be published. Required fields are marked *