Patent ID: 7627553

Claim:
A method for custom query generation implemented in a computer-readable storage medium and processed by a computer, comprising: receiving, by the computer, a query within a segmentation tool, wherein the query is directed to one or more data sources that are not mapped in the segmentation tool, and wherein metadata and data elements of data tables associated with the one or more data sources are unknown to the segmentation tool, unavailable, and unrecognized by query interfaces used by the segmentation tool, and wherein the query is received via an option of the segmentation tool; receiving, by the computer, a key selection and a table selection for the query, wherein the key and table selections are associated with data elements of a customer hierarchy that is mapped within the segmentation tool to different data sources, the key selection and table selection received from the segmentation tool via selections made by a business analyst within the segmentation tool; modifying, by the computer, the query using the key and table selections, the query modified to include an additional portion to the query, the addition portion including wrapping Structured Query Language (SQL) WHERE clause statements used to make a modified query and the modified query now identified as a custom query, the additional portion permits the results from the query when executed, as part of the custom query, to be integrated with the customer hierarchy via the SQL WHERE clause statements that execute as a wrapper within the custom query; and generating, by the computer, the custom query as the wrapper that includes the query before it was modified and the additional portion having the SQL WHERE clause statements, wherein when the custom query is executed within the segmentation tool to generate a customer segment for a marketing campaign and when the query as part of the custom query is executed the unmapped data sources are queried to get the results and then when the additional portion of the custom query is executed against the results from the unmapped data sources the SQL WHERE clause statements are executed by using the key and table selections, to acquire selective data elements from the customer hierarchy in order to produce the customer segment.