Reputation: 65
Not sure if this is possible, but I want to change the value of a result that's given by a query. For example, here is my query:
SELECT COUNT(DISTINCT `entity_id`)
FROM `catalog_product_entity_int`
WHERE (entity_type_id='4')
I want this query to always return X instead of the real value of the result.
EDIT: Should have been more specific. I DO NOT have access to the code calling this query.
Upvotes: 0
Views: 117
Reputation: 432261
If you can't change the code (as per your comment on the question), you can't make it return something different. Different code will return something different...
So "not possible" unless changes can be made to the query
Unless you can "hide" or "mask" the table catalog_product_entity_int
so it's your table with, say, 1615 rows in it. But this depends on no other query using this table. In SQL Server you could use synonyms or schemas: not sure how you'd achieve this (if practical) in MySQL)
Upvotes: 0
Reputation: 6718
May be you need something like this?
SELECT COUNT(DISTINCT `entity_id`) as 'X'
FROM `catalog_product_entity_int`
WHERE (entity_type_id='4')
Upvotes: 0
Reputation: 3273
Well, if you have access to this query, you can do this:
SELECT X FROM table
It will always return X, but I am not sure if that's what you meant :D
Upvotes: 0
Reputation: 247690
If you want to hard code your value then you would just do the following:
SELECT 'X'
FROM
(
SELECT COUNT(DISTINCT `entity_id`)
FROM `catalog_product_entity_int`
WHERE (entity_type_id='4')
) As MySearch
Not sue why you would want to do this.
Upvotes: 1