March 5, 2012 at 2:55 am
I have a table called rptOutputTmp
Create Table rptOutputTmp
(
StockSymbol Varchar(50),
DescriptionFld Varchar(100)
)
The table contains data like ;
IBM Laptop and Desktop business
HP No innovation
Apple Redifning electronics
I need to generate a sorted output from this table based on the 9 rules mentioned below
1. StockSymbol or DescriptionFld is EXACT match
2. StockSymbol starts with entry ending with space (e.g., symbol= MSXXX ) – IBM<SPACE>
3. StockSymbol has entry anywhere(e.g., symbol= XXXMSXXX ), Sort by position IBM appears anywhere.
Sort by position of that in the string. EG. IBM,KNIBM
4. DescriptionFld Starts with entry ending with space( e.g., name= BUSINESS XXX ) - – IBM<SPACE>
5. DescriptionFld Starts with entry with spaces at both end (e.g., name= BUSINESS XXX ) - <SPACE>IBM<SPACE> appears anywhere in the string
6. DescriptionFld Starts with entry (e.g., name= BUSINESSXXX ) – Starting word should be IBM
7. DescriptionFld contains entry and enclosed by spaces, sort by position (e.g., name= XXX BUSINESS XXX )- Sort by position IBM appears anywhere. Sort by position of that in the string. EG. IBM,KNIBM
8. DescriptionFld contains entry, sort by position( e.g., DescriptionFld= XXXBUSINESSXXX ) –DO-
9. StockSymbol or DescriptionFld equals to any individual word in entry
Could anyone suggest the best approach to do this ?
March 5, 2012 at 8:48 am
What is it sorted on? The minimum rule number it satisfies?
March 5, 2012 at 9:19 am
Please provide setup of data for each of the rule you've listed, so we can see exactly what your rules are.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply