jakebur01
Members-
Posts
885 -
Joined
-
Last visited
Everything posted by jakebur01
-
Thank you for your help. Those were the correct dates.
-
Cool. How reliable is strtotime? How does this code look? It seems to work well. If you see something I should alter, please let me know. $sunday=date('Y-m-d', strtotime('last Sunday', strtotime('last Saturday', strtotime('now')))); $saturday=date('Y-m-d', strtotime('last Saturday', strtotime('now'))); $firstday=date('Y-m-d', strtotime('next Sunday', strtotime('last Friday', strtotime('first day of last month')))); $lastday = date('Y-m-d', strtotime('next Saturday', strtotime('last Friday', strtotime('first day of this month')))); echo"$sunday<br />$saturday<hr />"; echo"$firstday<br />$lastday";
-
Sorry... Yes, thank you. I guess I got so caught up in trying to find out the last friday of the previous month that I forgot what my original question was. Should that code find the previous Sunday - Saturday no matter what week you are in?
-
I ran your code and got these two dates: 2011-08-28 2011-09-03
-
If I could find the last Friday of the previous month and add one.... this would give me my ending period date. And I found the last Friday for the month before last and add two... this would give me my Starting period date.
-
Ok... This may help. I just learned this. Our company uses 4-week and 5-week periods. The last friday of the month makes up the last week of the month. No, I have not run it yet. I wasn't sure if you understood what I was trying to do or not.
-
Let me be more specific. Look at the table. table Id Saturday Sunday 0 2011-07-31 2011-08-06 1 2011-08-07 2011-08-13 2 2011-08-14 2011-08-20 3 2011-08-21 2011-08-27 4 2011-08-28 2011-09-03 5 2011-09-04 2011-09-10 6 2011-09-11 2011-09-17 7 2011-09-18 2011-09-24 8 2011-09-25 2011-10-01 9 2011-10-02 2011-10-08 If the current date is 2011-10-07, how could I use php to query the table for last months periods (which are Sat. 8/28 - Sun. 10/01)? How can I get php to know how my week periods are setup? I could set up a separate table and store the period range for each month, but I would rather have the whole thing do it automatically if I could. Take a look at how our periods are set up below. It will help if you look on a calendar to see what I am talking about. Jan. 1/2-1/29 Feb. 1/30-2/26 Mar. 2/27-3/26 Apr. 3/27-4/30 May 5/1-5/28 Jun. 5/29-6/25 July 6/26-7/30 Aug. 7/31-8/27 Sept. 8/28-10/1 Thanks.
-
The problem is I don't know how to retrieve the info above. I have the dates, but I don't know how to retrieve it. It is not going to have a html form field to select date periods. I want it to automatically select the previous months weeks. So, like today if I run the script I want it to know to retrieve the previous month which is September and know what dates to select in september.... which would be 08/28 - 09/03.
-
Sample Structure: Id (int 11), Sunday (date), Saturday (date) Sample Data: 0 2011-08-28 2011-09-03 1 2011-09-04 2011-09-10 Let say as an example the table above is filled with every week this year. How could I query it for any month of the year. If I wanted to query it for April 2011, how could I do that and it contain all the weeks that fall within that month? Every Sunday - Saturday period within any month I pick. I can find the previous Sunday, that as not a big of a concern as being able to do this. ___________________________ If it would be hard to query the sample table. I could store the data a different way maybe? Calculate what month the previous week is in before I store it and use a table like this: Id, Month, Year, Sunday, Saturday 0 04 2011 2011-08-28 2011-09-03
-
I need to do some reporting and I need some help. The reporting periods are as follows: 08/28-09/03 09/04-09/10 09/11-09/17 09/18-09/24 09/25-10/01 So, they are Sunday through Saturday throughout each month. Say the date is Sept. 7.... How can I find out the date of the Sunday before last. How can I know what month I am reporting for? I am querying the database each Wed. for sales data from the previous month. I want to take the totals from my query and store them in a separate table. The problem is, I don't know how to find out what month the previous week falls into. And I don't know how to find the date of the Sunday before last. Thanks, Jake
-
is there a way to trim everything in front of the last backslash?
jakebur01 replied to jakebur01's topic in PHP Coding Help
Thanks. I used this: $trimFile = end(explode('\\',$trimFile)); -
Does mysql not care for underscores too much?
-
I need this within the next two hours. If I have to go through the trouble of building a new table. It might be just as fast for me to import the data from the original query into a table then query the data using php and insert the customers whos sales are above 500 into a secondary table.
-
That's a good idea. If it were you, how would you go about doing that?
-
ar_cust_mast.COMPANY ar_cust_mast.CUSTOMER_NUM ar_cust_mast.CUSTOMER_NAME ar_cust_mast.ADDRESS_1 ar_cust_mast.ADDRESS_2 ar_cust_mast.ADDRESS_3 ar_cust_mast.CITY ar_cust_mast.STATE ar_cust_mast.ZIP_CODE ar_cust_mast.PHONE_1 ar_cust_mast.PHONE_2 ar_cust_mast.CONTACT_1 ar_cust_mast.CONTACT_2 ar_cust_mast.EMAIL_1 ar_cust_mast.EMAIL_2 ar_cust_mast.WEBSITE ar_cust_mast.ALPHA_SORT_KEY ar_cust_mast.NORMAL_SHIP_TO ar_cust_mast.CUSTOMER_CLASS ar_cust_mast.SLSP_TERR ar_cust_mast.TERMS_CODE ar_cust_mast.TAX_CODE ar_cust_mast.TAX_TYPE ar_cust_mast.PRICE_LEVEL ar_cust_mast.GEOGRAPHY_CODE ar_cust_mast.GL_TABLE ar_cust_mast.MTD_SALES_AMT ar_cust_mast.MTD_COST_AMT ar_cust_mast.YTD_SALES_AMT ar_cust_mast.YTD_COST_AMT ar_cust_mast.PYR_SALES_AMT ar_cust_mast.PYR_COST_AMT ar_cust_mast.BALANCE ar_cust_mast.HIGH_BALANCE ar_cust_mast.CREDIT_LIMIT ar_cust_mast.SITE_CHARGE ar_cust_mast.MESSAGE ar_cust_mast.ON_HOLD ar_cust_mast.STORE_SO_SALES ar_cust_mast.BACKORDER_FLAG ar_cust_mast.STATEMENT_CODE ar_cust_mast.STORE_SO_INVOICE ar_cust_mast.STORE_PAYMENT ar_cust_mast.RECEIVE_DUN ar_cust_mast.LAST_DUN_SENT ar_cust_mast.SVC_CHG_GRACE_PD ar_cust_mast.COMM_PCT ar_cust_mast.OFF_INV_DISC_PCT ar_cust_mast.ROUTE ar_cust_mast.LEDGERCARD_SEQ ar_cust_mast.USE_LEDGERCARDS ar_cust_mast.DEFAULT_BRANCH ar_cust_mast.CREDIT_CHECK ar_cust_mast.INCLUDE_INV ar_cust_mast.ACTIVE ar_cust_mast.NOT_USED_2 ar_cust_mast.PO_REQUIRED ar_cust_mast.UPS_GROUND_CODE ar_cust_mast.CUST_PRICE_CLASS ar_cust_mast.PICK_TKT_PRICES ar_cust_mast.PRINT_CUST_ITEM ar_cust_mast.NOT_USED_3 ar_cust_mast.ASSIGNED_DATE ar_cust_mast.LEAD_SOURCE ar_cust_mast.OPENED_DATE ar_cust_mast.LAST_SALE_DATE ar_cust_mast.LAST_PMT_DATE ar_cust_mast.HIGH_BAL_DATE ar_cust_mast.LAST_DUN_DATE ar_cust_mast.TAX_EXEMPT_NUM ar_cust_mast.SHIP_VIA ar_cust_mast.UPS_ZONE ar_ship_to_addr.COMPANY ar_ship_to_addr.CUSTOMER_NUM ar_ship_to_addr.SHIP_TO ar_ship_to_addr.SHIP_TO_NAME ar_ship_to_addr.SHIP_TO_ADDR_1 ar_ship_to_addr.SHIP_TO_ADDR_2 ar_ship_to_addr.SHIP_TO_ADDR_3 ar_ship_to_addr.CITY ar_ship_to_addr.STATE ar_ship_to_addr.ZIP_CODE sa_cust_item_cls.COMPANY sa_cust_item_cls.CUSTOMER_NUM sa_cust_item_cls.ITEM_CLASS sa_cust_item_cls.SHIP_TO sa_cust_item_cls.SALES_OLDEST_PD sa_cust_item_cls.SALES_PD_2 sa_cust_item_cls.SALES_PD_3 sa_cust_item_cls.SALES_PD_4 sa_cust_item_cls.SALES_PD_5 sa_cust_item_cls.SALES_PD_6 sa_cust_item_cls.SALES_PD_7 sa_cust_item_cls.SALES_PD_8 sa_cust_item_cls.SALES_PD_9 sa_cust_item_cls.SALES_PD_10 sa_cust_item_cls.SALES_PD_11 sa_cust_item_cls.SALES_PD_12 sa_cust_item_cls.SALES_PD_13 sa_cust_item_cls.SALES_PD_14 sa_cust_item_cls.SALES_PD_15 sa_cust_item_cls.SALES_PD_16 sa_cust_item_cls.SALES_PD_17 sa_cust_item_cls.SALES_PD_18 sa_cust_item_cls.SALES_PD_19 sa_cust_item_cls.SALES_PD_20 sa_cust_item_cls.SALES_PD_21 sa_cust_item_cls.SALES_PD_22 sa_cust_item_cls.SALES_PD_23 sa_cust_item_cls.SALES_PD_24 sa_cust_item_cls.SALES_PD_25 sa_cust_item_cls.SALES_LAST_PD_26 sa_cust_item_cls.SALES_CURR sa_cust_item_cls.COST_OLDEST_PD sa_cust_item_cls.COST_PD_2 sa_cust_item_cls.COST_PD_3 sa_cust_item_cls.COST_PD_4 sa_cust_item_cls.COST_PD_5 sa_cust_item_cls.COST_PD_6 sa_cust_item_cls.COST_PD_7 sa_cust_item_cls.COST_PD_8 sa_cust_item_cls.COST_PD_9 sa_cust_item_cls.COST_PD_10 sa_cust_item_cls.COST_PD_11 sa_cust_item_cls.COST_PD_12 sa_cust_item_cls.COST_PD_13 sa_cust_item_cls.COST_PD_14 sa_cust_item_cls.COST_PD_15 sa_cust_item_cls.COST_PD_16 sa_cust_item_cls.COST_PD_17 sa_cust_item_cls.COST_PD_18 sa_cust_item_cls.COST_PD_19 sa_cust_item_cls.COST_PD_20 sa_cust_item_cls.COST_PD_21 sa_cust_item_cls.COST_PD_22 sa_cust_item_cls.COST_PD_23 sa_cust_item_cls.COST_PD_24 sa_cust_item_cls.COST_PD_25 sa_cust_item_cls.COST_LAST_PD_26 sa_cust_item_cls.COST_CURR_PD_27 sa_cust_item_cls.NOT_USED_1 01 1273 company name 112 test drive 112 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 113 test dr my city, st my city st 24842 1273 YKP S 13 0 0 0 0 0 0 0 0 0 13 0 64 0 0 0 0 9 0 32 0 0 0 10 0 0 0 10 0 0 0 0 0 0 0 0 0 10 0 46 0 0 0 0 6 0 18 0 0 0 7 0 0 0 01 1273 company name 113 test drive 113 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 114 test dr my city, st my city st 24842 1273 YKT S 0 0 0 0 0 0 0 0 0 0 0 214 214 -214 0 0 0 0 0 0 0 0 0 0 0 486 0 0 0 0 0 0 0 0 0 0 0 0 141 158 -141 0 0 0 0 0 0 0 0 0 0 0 360 0 01 1273 company name 114 test drive 114 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 115 test dr my city, st my city st 24842 1273 YKU S 0 0 0 0 0 0 0 0 0 923 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 697 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
cust_mast.CUSTOMER_NUM is the customer number column. Each table has a column with the customer number in it. However, when getting the totals, the customer's number may be listed in sa_cust_item_cls three times since their are three categories per customer. customer1 'YKT' sales period 1 sales period 2 sales period 3 etc... customer1 'YKP' sales period 1 sales period 2 sales period 3 etc... customer1 'YKU' sales period 1 sales period 2 sales period 3 etc... customer2 'YKT' sales period 1 sales period 2 sales period 3 etc... customer2 'YKP' sales period 1 sales period 2 sales period 3 etc... customer2 'YKU' sales period 1 sales period 2 sales period 3 etc... I want the total of all the sales periods and all three categories per customer. If the customers total sales for those three categories are not >=500, then I do not want it to select the customers information I want it to only select the customers whose sales for those three categories are 500 or greater.
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU' at line 15 SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM LEFT JOIN sa_cust_item_cls ON ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD' AND (SELECT sa_cust_item_cls.SALES_OLDEST_PD + sa_cust_item_cls.SALES_PD_2 + sa_cust_item_cls.SALES_PD_3 + sa_cust_item_cls.SALES_PD_4 + sa_cust_item_cls.SALES_PD_5 + sa_cust_item_cls.SALES_PD_6 + sa_cust_item_cls.SALES_PD_7 + sa_cust_item_cls.SALES_PD_8 + sa_cust_item_cls.SALES_PD_9 + sa_cust_item_cls.SALES_PD_10 + sa_cust_item_cls.SALES_PD_11 + sa_cust_item_cls.SALES_PD_12 + sa_cust_item_cls.SALES_PD_13 + sa_cust_item_cls.SALES_PD_14 + sa_cust_item_cls.SALES_PD_15 + sa_cust_item_cls.SALES_PD_16 + sa_cust_item_cls.SALES_PD_17 + sa_cust_item_cls.SALES_PD_18 + sa_cust_item_cls.SALES_PD_19 + sa_cust_item_cls.SALES_PD_20 + sa_cust_item_cls.SALES_PD_21 + sa_cust_item_cls.SALES_PD_22 + sa_cust_item_cls.SALES_PD_23 + sa_cust_item_cls.SALES_PD_24 + sa_cust_item_cls.SALES_PD_25 + sa_cust_item_cls.SALES_LAST_PD_26 + sa_cust_item_cls.SALES_CURR AS period_totals WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM) period_totals >= '500';
-
I have not added it yet. I am trying to figure it out. How can I add the columns of the three categories together per customer and then determine whether it is selected or not based on if the complete total is 500 or more?
-
This is what I am wanting to add to my main query. Where this total is greater than 500 it will retrieve the rows. SELECT sa_cust_item_cls.SALES_OLDEST_PD + sa_cust_item_cls.SALES_PD_2 + sa_cust_item_cls.SALES_PD_3 + sa_cust_item_cls.SALES_PD_4 + sa_cust_item_cls.SALES_PD_5 + sa_cust_item_cls.SALES_PD_6 + sa_cust_item_cls.SALES_PD_7 + sa_cust_item_cls.SALES_PD_8 + sa_cust_item_cls.SALES_PD_9 + sa_cust_item_cls.SALES_PD_10 + sa_cust_item_cls.SALES_PD_11 + sa_cust_item_cls.SALES_PD_12 + sa_cust_item_cls.SALES_PD_13 + sa_cust_item_cls.SALES_PD_14 + sa_cust_item_cls.SALES_PD_15 + sa_cust_item_cls.SALES_PD_16 + sa_cust_item_cls.SALES_PD_17 + sa_cust_item_cls.SALES_PD_18 + sa_cust_item_cls.SALES_PD_19 + sa_cust_item_cls.SALES_PD_20 + sa_cust_item_cls.SALES_PD_21 + sa_cust_item_cls.SALES_PD_22 + sa_cust_item_cls.SALES_PD_23 + sa_cust_item_cls.SALES_PD_24 + sa_cust_item_cls.SALES_PD_25 + sa_cust_item_cls.SALES_LAST_PD_26 + sa_cust_item_cls.SALES_CURR AS period_totals WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM Main Query SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD'; Basically I only want the customers whose sales in categories YKU,YKT,and YKP are greater than 500 for the total of the sales periods. And I am appending the shipping address table so I can get the customers shipping addresses in the process.
-
This should have said I am joining Customer Mater and Customer Ship Address Table. The Customer Class table is the one that has all the periods in it.
-
I am joining two tables together. Customer Master and Customer Sales By Class. The Customer Class table is filled with customer numbers, categories, and sales periods. I would like the total of the sales periods and categories (YKP,YKU,YKT). If the the total of the periods and three categories for the customer is >= 500 it will grab the row. Thanks, Jake PERIODS sa_cust_item_cls.SALES_OLDEST_PD sa_cust_item_cls.SALES_PD_2 sa_cust_item_cls.SALES_PD_3 sa_cust_item_cls.SALES_PD_4 sa_cust_item_cls.SALES_PD_5 sa_cust_item_cls.SALES_PD_6 sa_cust_item_cls.SALES_PD_7 sa_cust_item_cls.SALES_PD_8 sa_cust_item_cls.SALES_PD_9 sa_cust_item_cls.SALES_PD_10 sa_cust_item_cls.SALES_PD_11 sa_cust_item_cls.SALES_PD_12 sa_cust_item_cls.SALES_PD_13 sa_cust_item_cls.SALES_PD_14 sa_cust_item_cls.SALES_PD_15 sa_cust_item_cls.SALES_PD_16 sa_cust_item_cls.SALES_PD_17 sa_cust_item_cls.SALES_PD_18 sa_cust_item_cls.SALES_PD_19 sa_cust_item_cls.SALES_PD_20 sa_cust_item_cls.SALES_PD_21 sa_cust_item_cls.SALES_PD_22 sa_cust_item_cls.SALES_PD_23 sa_cust_item_cls.SALES_PD_24 sa_cust_item_cls.SALES_PD_25 sa_cust_item_cls.SALES_LAST_PD_26 sa_cust_item_cls.SALES_CURR CURRENT QUERY SO FAR SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD';
-
TOTAL WAS 79313 AFTER QUERY WAS 75327 It is right. We added a couple of new product lines. I did not realize how many parts that consisted of. Thanks, Jake
-
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')
-
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'