This is my query
SELECT concat(sf.from_location, "-",sf.to_location) as from_to_city,
count( *) as seach_count,
(SELECT count(DISTINCT fb.origin) as no_of_book
FROM flight_booking_details as fb
WHERE fb.status="BOOKING_CONFIRMED" and
from_code=journey_from and
to_code=journey_to AND
DATE(fb.created_datetime) >="2018-07-01" AND
DATE(fb.created_datetime) <="2018-07-04" AND
fb.journey_from = 'BLR' AND
fb.journey_to = 'DEL' ) as booking_count
FROM search_flight_history sf
WHERE DATE(sf.created_datetime) >= '2018-07-01' AND
DATE(sf.created_datetime) <= '2018-07-04' AND
(sf.from_location = 'BLR' OR
sf.from_code = 'BLR') AND
(sf.to_location = 'DEL' OR
sf.to_code = 'DEL')
GROUP BY from_code,
to_code
Here I need to find the Total Records of this query.
Please any one help me to find this one
If really just need the count of rows returned by your query, you can try the following:
select count(*)
from
(
SELECT concat(sf.from_location, "-",sf.to_location) as from_to_city,
count( *) as seach_count,
(SELECT count(DISTINCT fb.origin) as no_of_book
FROM flight_booking_details as fb
WHERE fb.status="BOOKING_CONFIRMED" and
from_code=journey_from and
to_code=journey_to AND
DATE(fb.created_datetime) >="2018-07-01" AND
DATE(fb.created_datetime) <="2018-07-04" AND
fb.journey_from = 'BLR' AND
fb.journey_to = 'DEL' ) as booking_count
FROM search_flight_history sf
WHERE DATE(sf.created_datetime) >= '2018-07-01' AND
DATE(sf.created_datetime) <= '2018-07-04' AND
(sf.from_location = 'BLR' OR
sf.from_code = 'BLR') AND
(sf.to_location = 'DEL' OR
sf.to_code = 'DEL')
GROUP BY from_code,
to_code
) X;