I have changed the forumla to (see below) and it seems to be running perfectly fine now . Thank you for your support .
Regards
D
PHP Code:
SELECT sub.*, case when rm_sales_band = '2M to 4M' then 'Kirsty' else RM end as rm into #rmtmp FROM (SELECT[fdmsaccountno], [ho], [rm_sales_band], [rm_code], [post_code], CASE WHEN Isnumeric(RIGHT(LEFT(post_code, 2), 1)) = '0' THEN LEFT(post_code, 2) ELSE LEFT(post_code, 1) END AS 'sPostcode', [mcc_code] FROM [FDMS].[dbo].[dim_outlet] WHERE [rm_sales_band]IN ( '2M to 4m', '4m +' ) AND [ho] = 'Y' AND rm_code = 'na' AND iso_account = 'N' AND fdmsaccountno NOT IN (SELECT [ta_mid] FROM fdms_partnerreporting.tmp.trade_assocations)) Sub INNER JOIN [geo_pca_sellers] ON [pca] = spostcode
Last edited by Cutter; 08-02-2012 at 04:46 PM.
Reason: Added code tags
Bookmarks