I have a table that I have to select out of it all the records that have requested a brochure on their own accord (ie thay have not received a mailer). This enatils searcing all fields, to make sure there is no MAIL4, Encl Ms, etc etc. As this is a UNIX import all the fields are all over the place and each record has its own data in its own column. This is because some have multiple bookings and multiple brochures etc. I tried to do this with a sql query which ended up huge. Also the codes I have to select from are nearly three pages in a word document.
My original query is below the data extract, which works on the word MAIL, however I have to search on all the other codes as well to recover all the records of "people who have requested a brochure without a mailer being sent"
My question is, is there a simpler way of doing this? or am I missing something here.......
0000388,Active,MR,M,abc,5 Wave Drive,,Kansas,Kent,DT6 1ZX,UK,01999
123456,SAME,,Aþ0000388,0105297,Firm,12469,10/08/02,OC,12470,12580,12584þ0000388,Broch
BH98,0010884,05/11/97,11/03/98,OC,MAIL4,,Encl 99,,07/10/98,10/06/99,,99CLIENT,,,Broch
BH99,0035504,04/11/98,10/11/98,OC,99BROC,,,,Encl MS,,04/06/99,04/06/99,,99C,,,,,Broch
BH00,,17/11/99,17/11/99,,97R,,,,,,Encl 01,,31/10/00,31/10/00,,CMAIL3,,,,,,,Encl
02,,20/10/01,20/10/01,,CMAIL3,,,,,,,,Broch
BH02,0096836,20/11/01,30/11/01,OC,2002BROREQ,,,,,,,,,Broch BH03,,21/11/02,21/11/02,,02C
QUERY
SELECT [NO BOOKINGS].ID, [NO BOOKINGS].Field1, [NO BOOKINGS].Status, [NO BOOKINGS].Title, [NO BOOKINGS].Initial, [NO BOOKINGS].Surname, [NO BOOKINGS].Address, [NO BOOKINGS].Address1, [NO BOOKINGS].Town, [NO BOOKINGS].County, [NO BOOKINGS].[Post Code], [NO BOOKINGS].Country, [NO BOOKINGS].Telephone, [NO BOOKINGS].Telephone2, [NO BOOKINGS].Field14, [NO BOOKINGS].Email, [NO BOOKINGS].Bookings, [NO BOOKINGS].Field17, [NO BOOKINGS].Booked_Date, [NO BOOKINGS].Field19, [NO BOOKINGS].Field20, [NO BOOKINGS].Field21, [NO BOOKINGS].Field22, [NO BOOKINGS].Field23, [NO BOOKINGS].Field24, [NO BOOKINGS].Field25, [NO BOOKINGS].Field26, [NO BOOKINGS].Field27, [NO BOOKINGS].Field28, [NO BOOKINGS].Field29, [NO BOOKINGS].Field30, [NO BOOKINGS].Field31, [NO BOOKINGS].Field32, [NO BOOKINGS].Field33, [NO BOOKINGS].Field34, [NO BOOKINGS].Field35, [NO BOOKINGS].Field36, [NO BOOKINGS].Field37, [NO BOOKINGS].Field38, [NO BOOKINGS].Field39, [NO BOOKINGS].Field40, [NO BOOKINGS].Field41, [NO BOOKINGS].Field42, [NO BOOKINGS].Field43, [NO BOOKINGS].Field44, [NO BOOKINGS].Field45, [NO BOOKINGS].Field46, [NO BOOKINGS].Field47, [NO BOOKINGS].Field48, [NO BOOKINGS].Field49, [NO BOOKINGS].Field50, [NO BOOKINGS].Field51, [NO BOOKINGS].Field52, [NO BOOKINGS].Field53, [NO BOOKINGS].Field54, [NO BOOKINGS].Field55, [NO BOOKINGS].Field56, [NO BOOKINGS].Field57, [NO BOOKINGS].Field58, [NO BOOKINGS].Field59, [NO BOOKINGS].Field60, [NO BOOKINGS].Field61, [NO BOOKINGS].Field62, [NO BOOKINGS].Field63, [NO BOOKINGS].Field64
FROM [NO BOOKINGS]
WHERE ((([NO BOOKINGS].Field58) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field17) Not Like "*MAIL*") OR ((([NO BOOKINGS].Booked_Date) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field19) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field20) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field21) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field22) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field23) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field24) Not Like "*MAIL*");
My original query is below the data extract, which works on the word MAIL, however I have to search on all the other codes as well to recover all the records of "people who have requested a brochure without a mailer being sent"
My question is, is there a simpler way of doing this? or am I missing something here.......
0000388,Active,MR,M,abc,5 Wave Drive,,Kansas,Kent,DT6 1ZX,UK,01999
123456,SAME,,Aþ0000388,0105297,Firm,12469,10/08/02,OC,12470,12580,12584þ0000388,Broch
BH98,0010884,05/11/97,11/03/98,OC,MAIL4,,Encl 99,,07/10/98,10/06/99,,99CLIENT,,,Broch
BH99,0035504,04/11/98,10/11/98,OC,99BROC,,,,Encl MS,,04/06/99,04/06/99,,99C,,,,,Broch
BH00,,17/11/99,17/11/99,,97R,,,,,,Encl 01,,31/10/00,31/10/00,,CMAIL3,,,,,,,Encl
02,,20/10/01,20/10/01,,CMAIL3,,,,,,,,Broch
BH02,0096836,20/11/01,30/11/01,OC,2002BROREQ,,,,,,,,,Broch BH03,,21/11/02,21/11/02,,02C
QUERY
SELECT [NO BOOKINGS].ID, [NO BOOKINGS].Field1, [NO BOOKINGS].Status, [NO BOOKINGS].Title, [NO BOOKINGS].Initial, [NO BOOKINGS].Surname, [NO BOOKINGS].Address, [NO BOOKINGS].Address1, [NO BOOKINGS].Town, [NO BOOKINGS].County, [NO BOOKINGS].[Post Code], [NO BOOKINGS].Country, [NO BOOKINGS].Telephone, [NO BOOKINGS].Telephone2, [NO BOOKINGS].Field14, [NO BOOKINGS].Email, [NO BOOKINGS].Bookings, [NO BOOKINGS].Field17, [NO BOOKINGS].Booked_Date, [NO BOOKINGS].Field19, [NO BOOKINGS].Field20, [NO BOOKINGS].Field21, [NO BOOKINGS].Field22, [NO BOOKINGS].Field23, [NO BOOKINGS].Field24, [NO BOOKINGS].Field25, [NO BOOKINGS].Field26, [NO BOOKINGS].Field27, [NO BOOKINGS].Field28, [NO BOOKINGS].Field29, [NO BOOKINGS].Field30, [NO BOOKINGS].Field31, [NO BOOKINGS].Field32, [NO BOOKINGS].Field33, [NO BOOKINGS].Field34, [NO BOOKINGS].Field35, [NO BOOKINGS].Field36, [NO BOOKINGS].Field37, [NO BOOKINGS].Field38, [NO BOOKINGS].Field39, [NO BOOKINGS].Field40, [NO BOOKINGS].Field41, [NO BOOKINGS].Field42, [NO BOOKINGS].Field43, [NO BOOKINGS].Field44, [NO BOOKINGS].Field45, [NO BOOKINGS].Field46, [NO BOOKINGS].Field47, [NO BOOKINGS].Field48, [NO BOOKINGS].Field49, [NO BOOKINGS].Field50, [NO BOOKINGS].Field51, [NO BOOKINGS].Field52, [NO BOOKINGS].Field53, [NO BOOKINGS].Field54, [NO BOOKINGS].Field55, [NO BOOKINGS].Field56, [NO BOOKINGS].Field57, [NO BOOKINGS].Field58, [NO BOOKINGS].Field59, [NO BOOKINGS].Field60, [NO BOOKINGS].Field61, [NO BOOKINGS].Field62, [NO BOOKINGS].Field63, [NO BOOKINGS].Field64
FROM [NO BOOKINGS]
WHERE ((([NO BOOKINGS].Field58) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field17) Not Like "*MAIL*") OR ((([NO BOOKINGS].Booked_Date) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field19) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field20) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field21) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field22) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field23) Not Like "*MAIL*") OR ((([NO BOOKINGS].Field24) Not Like "*MAIL*");