Jump to content

IN is not working


jakebur01

Recommended Posts

I am having trouble getting this query to filter my rows. There are about 75,000 total and only about 45,000 should be selected.  I tried using this IN and using the OR and I could not get either to work.

 

IN

SELECT * FROM table WHERE `Cls` IN('P27','O34','P08','R01','R02','R33','O26','O27','
W30','P45','R09','BBL','BBM','P15','R12','P75','P65','P80','R17','P79','P40','P90',
'P91','P92','P93','P94','P95','P96','P97','P98','P99','R14','R15','R16','P59','O43',
'B02','P81','GLO','CAA','CAB','P02','CAT','CAW','CAY','CAR','CAS','CAX','CAZ','R38',
'P49','R22','O31','P56','R39','SAW','O18','O19','O20','O21','O22','O23','O24','O25',
'O28','O29','O30','R35','W20','W21','W25','O07','O09','O10','O11','O12','O13','R36',
'W12','W11','LTO','P84','P48','P46','P60','R03','R10','P76','R05','P51','P41','E20',
'P33','P47','P53','P74','R23','SUN','P04','P30','P83','R19','P07','R20','BTY','BTZ',
'EAG','P36','P50','R04','P86','R28','GW7','GW3','GW6','GW4','GW2','GW5','GW1','O45',
'O44','HDA','HFI','HHO',' IG','R31','J01','J05','J10',' LG','LTP','LOG','DIX','GAP',
'LTQ','PNT','M20','MSC','P52','P87','SUP','TBP','P35','R18','OPT','P54','O46','PRK',
'P37','R48','O36','LPA','LPF','LPG','LPU','R13','P34','P44','P78','P82','P32','R11',
'ELV','O35','SFT','SFY','W46','O01','O02','O03','O04','O05','O06','R34','W01','W02',
'W03','W05','P73','R21','P85','O00','O32','O52','P88','W32','P57','SDP','SLM','R41',
'NGK','P77','R24','O61','SPA','SPE','P05','P43','R26','R37','P31','R25','R29','P67',
'P58','P68','P70','R08','HWR','O33','P42','R32','P61','EDP','EDR','O42','P19','P20',
'P21','P22','P23','O40','R27','P55','TRU','P71','B03','P09','WEL','P72','R06','R07',
'W43','YKP','P06','E00','LTA','M00','M01','M02','M03','MO9','M10','M11','SDA','SDL',
'SUL','TBA')

 

OR

SELECT * FROM table WHERE Cls ='P27'OR Cls ='O34'OR Cls ='P08'OR Cls ='R01'OR Cls ='R02'OR Cls ='R33'OR Cls ='O26'OR Cls ='O27'OR Cls ='W30'OR Cls ='P45'OR Cls ='R09'OR Cls ='BBL'OR Cls ='BBM'OR Cls ='P15'OR Cls ='R12'OR Cls ='P75'OR Cls ='P65'OR Cls ='P80'OR Cls ='R17'OR Cls ='P79'OR Cls ='P40'OR Cls ='P90'OR Cls ='P91'OR Cls ='P92'OR Cls ='P93'OR Cls ='P94'OR Cls ='P95'OR Cls ='P96'OR Cls ='P97'OR Cls ='P98'OR Cls ='P99'OR Cls ='R14'OR Cls ='R15'OR Cls ='R16'OR Cls ='P59'OR Cls ='O43'OR Cls ='B02'OR Cls ='P81'OR Cls ='GLO'OR Cls ='CAA'OR Cls ='CAB'OR Cls ='P02'OR Cls ='CAT'OR Cls ='CAW'OR Cls ='CAY'OR Cls ='CAR'OR Cls ='CAS'OR Cls ='CAX'OR Cls ='CAZ'OR Cls ='R38'OR Cls ='P49'OR Cls ='R22'OR Cls ='O31'OR Cls ='P56'OR Cls ='R39'OR Cls ='SAW'OR Cls ='O18'OR Cls ='O19'OR Cls ='O20'OR Cls ='O21'OR Cls ='O22'OR Cls ='O23'OR Cls ='O24'OR Cls ='O25'OR Cls ='O28'OR Cls ='O29'OR Cls ='O30'OR Cls ='R35'OR Cls ='W20'OR Cls ='W21'OR Cls ='W25'OR Cls ='O07'OR Cls ='O09'OR Cls ='O10'OR Cls ='O11'OR Cls ='O12'OR Cls ='O13'OR Cls ='R36'OR Cls ='W12'OR Cls ='W11'OR Cls ='LTO'OR Cls ='P84'OR Cls ='P48'OR Cls ='P46'OR Cls ='P60'OR Cls ='R03'OR Cls ='R10'OR Cls ='P76'OR Cls ='R05'OR Cls ='P51'OR Cls ='P41'OR Cls ='E20'OR Cls ='P33'OR Cls ='P47'OR Cls ='P53'OR Cls ='P74'OR Cls ='R23'OR Cls ='SUN'OR Cls ='P04'OR Cls ='P30'OR Cls ='P83'OR Cls ='R19'OR Cls ='P07'OR Cls ='R20'OR Cls ='BTY'OR Cls ='BTZ'OR Cls ='EAG'OR Cls ='P36'OR Cls ='P50'OR Cls ='R04'OR Cls ='P86'OR Cls ='R28'OR Cls ='GW7'OR Cls ='GW3'OR Cls ='GW6'OR Cls ='GW4'OR Cls ='GW2'OR Cls ='GW5'OR Cls ='GW1'OR Cls ='O45'OR Cls ='O44'OR Cls ='HDA'OR Cls ='HFI'OR Cls ='HHO'OR Cls =' IG'OR Cls ='R31'OR Cls ='J01'OR Cls ='J05'OR Cls ='J10'OR Cls =' LG'OR Cls ='LTP'OR Cls ='LOG'OR Cls ='DIX'OR Cls ='GAP'OR Cls ='LTQ'OR Cls ='PNT'OR Cls ='M20'OR Cls ='MSC'OR Cls ='P52'OR Cls ='P87'OR Cls ='SUP'OR Cls ='TBP'OR Cls ='P35'OR Cls ='R18'OR Cls ='OPT'OR Cls ='P54'OR Cls ='O46'OR Cls ='PRK'OR Cls ='P37'OR Cls ='R48'OR Cls ='O36'OR Cls ='LPA'OR Cls ='LPF'OR Cls ='LPG'OR Cls ='LPU'OR Cls ='R13'OR Cls ='P34'OR Cls ='P44'OR Cls ='P78'OR Cls ='P82'OR Cls ='P32'OR Cls ='R11'OR Cls ='ELV'OR Cls ='O35'OR Cls ='SFT'OR Cls ='SFY'OR Cls ='W46'OR Cls ='O01'OR Cls = 'O02'OR Cls ='O03'OR Cls ='O04'OR Cls ='O05'OR Cls ='O06'OR Cls ='R34'OR Cls ='W01'OR Cls ='W02'OR Cls ='W03'OR Cls ='W05'OR Cls ='P73'OR Cls ='R21'OR Cls ='P85'OR Cls = 'O00'OR Cls ='O32'OR Cls ='O52'OR Cls ='P88'OR Cls ='W32'OR Cls ='P57'OR Cls ='SDP'OR Cls ='SLM'OR Cls ='R41'OR Cls ='NGK'OR Cls ='P77'OR Cls ='R24'OR Cls ='O61'OR Cls = 'SPA'OR Cls ='SPE'OR Cls ='P05'OR Cls ='P43'OR Cls ='R26'OR Cls ='R37'OR Cls ='P31'OR Cls ='R25'OR Cls ='R29'OR Cls ='P67'OR Cls ='P58'OR Cls ='P68'OR Cls ='P70'OR Cls = 'R08'OR Cls ='HWR'OR Cls ='O33'OR Cls ='P42'OR Cls ='R32'OR Cls ='P61'OR Cls ='EDP'OR Cls ='EDR'OR Cls ='O42'OR Cls ='P19'OR Cls ='P20'OR Cls ='P21'OR Cls ='P22'OR Cls = 'P23'OR Cls ='O40'OR Cls ='R27'OR Cls ='P55'OR Cls ='TRU'OR Cls ='P71'OR Cls ='B03'OR Cls ='P09'OR Cls ='WEL'OR Cls ='P72'OR Cls ='R06'OR Cls ='R07'OR Cls ='W43'OR Cls = 'YKP'OR Cls ='P06'OR Cls ='E00'OR Cls ='LTA'OR Cls ='M00'OR Cls ='M01'OR Cls ='M02'OR Cls ='M03'OR Cls ='MO9'OR Cls ='M10'OR Cls ='M11'OR Cls ='SDA'OR Cls ='SDL'OR Cls = 'SUL'OR Cls ='TBA'

 

 

Link to comment
Share on other sites

Still not returning the correct rows. One time it returned about 35,000..... I ran it again and the next query was back up at 75,000.

SELECT * FROM table WHERE Cls IN (
'P27',
'O34',
'P08',
'R01',
'R02',
'R33',
'O26',
'O27',
'W30',
'P45',
'R09',
'BBL',
'BBM',
'P15',
'R12',
'P75',
'P65',
'P80',
'R17',
'P79',
'P40',
'P90',
'P91',
'P92',
'P93',
'P94',
'P95',
'P96',
'P97',
'P98',
'P99',
'R14',
'R15',
'R16',
'P59',
'O43',
'B02',
'P81',
'GLO',
'CAA',
'CAB',
'P02',
'CAT',
'CAW',
'CAY',
'CAR',
'CAS',
'CAX',
'CAZ',
'R38',
'P49',
'R22',
'O31',
'P56',
'R39',
'SAW',
'O18',
'O19',
'O20',
'O21',
'O22',
'O23',
'O24',
'O25',
'O28',
'O29',
'O30',
'R35',
'W20',
'W21',
'W25',
'O07',
'O09',
'O10',
'O11',
'O12',
'O13',
'R36',
'W12',
'W11',
'LTO',
'P84',
'P48',
'P46',
'P60',
'R03',
'R10',
'P76',
'R05',
'P51',
'P41',
'E20',
'P33',
'P47',
'P53',
'P74',
'R23',
'SUN',
'P04',
'P30',
'P83',
'R19',
'P07',
'R20',
'BTY',
'BTZ',
'EAG',
'P36',
'P50',
'R04',
'P86',
'R28',
'GW7',
'GW3',
'GW6',
'GW4',
'GW2',
'GW5',
'GW1',
'O45',
'O44',
'HDA',
'HFI',
'HHO',
' IG',
'R31',
'J01',
'J05',
'J10',
' LG',
'LTP',
'LOG',
'DIX',
'GAP',
'LTQ',
'PNT',
'M20',
'MSC',
'P52',
'P87',
'SUP',
'TBP',
'P35',
'R18',
'OPT',
'P54',
'O46',
'PRK',
'P37',
'R48',
'O36',
'LPA',
'LPF',
'LPG',
'LPU',
'R13',
'P34',
'P44',
'P78',
'P82',
'P32',
'R11',
'ELV',
'O35',
'SFT',
'SFY',
'W46',
'O01',
'O02',
'O03',
'O04',
'O05',
'O06',
'R34',
'W01',
'W02',
'W03',
'W05',
'P73',
'R21',
'P85',
'O00',
'O32',
'O52',
'P88',
'W32',
'P57',
'SDP',
'SLM',
'R41',
'NGK',
'P77',
'R24',
'O61',
'SPA',
'SPE',
'P05',
'P43',
'R26',
'R37',
'P31',
'R25',
'R29',
'P67',
'P58',
'P68',
'P70',
'R08',
'HWR',
'O33',
'P42',
'R32',
'P61',
'EDP',
'EDR',
'O42',
'P19',
'P20',
'P21',
'P22',
'P23',
'O40',
'R27',
'P55',
'TRU',
'P71',
'B03',
'P09',
'WEL',
'P72',
'R06',
'R07',
'W43',
'YKP',
'P06',
'E00',
'LTA',
'M00',
'M01',
'M02',
'M03',
'MO9',
'M10',
'M11',
'SDA',
'SDL',
'SUL',
'TBA')

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.