Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 hopkinsc
		
			hopkinsc
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
I want to create a new field in my script from 2 other fields but i also want to limit the data .
i.e.
DealNumber
DealName
I want to combine these 2 fields which is easy enough:
DealNumber & '-' & DealName AS [Deal Description],
I only want it to show DealNumber >=200050 and DealNumber <=200020 or DealNumber =900000 and call it [Meal Deals]
Can anyone please tell me how i would write this into the script?
Thanks
 
					
				
		
You can add an IF statement while generating the new column [Deal Description]
IF((DealNumber>=200050 and DealNumber<=200020) OR DealNumber=900000,DealNumber & '-' & DealName) as [Deal Description]
Hope this healps.
 
					
				
		
 volcore79
		
			volcore79
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Could you send an example file ?
 
					
				
		
You can add an IF statement while generating the new column [Deal Description]
IF((DealNumber>=200050 and DealNumber<=200020) OR DealNumber=900000,DealNumber & '-' & DealName) as [Deal Description]
Hope this healps.
 
					
				
		
 bismart
		
			bismart
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Think your selection criteria is wrong...
DealNumber cannot be >= 200050 and <= 200020
your code : DealNumber>=200050 and DealNumber<=200020 OR DealNumber=900000
Otherwise
Load
DealNumber & '-' DealName as [Deal Description]
from Tablename
where
DealNumber >= 200020 and DealNumber <=200050
OR DealNumber = 900000;
 hopkinsc
		
			hopkinsc
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Muralidhar, that worked great. Thanks.
