Skip to content
Advertisement

Not getting proper data while join two query in Mysql

Hi Everyone i am writing a query one query getting weekly data one is getting yesterday record from same table, when i execute both query separatally its working properly but when join both query then yesterday data query not getting proper output.

Sampal data

https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=8a678d12df7643000838c2f442d4d85a

query 1- weekly data

quary-2 yesterday data

expected output,

driver_id car_number day1_trip day2_trip day3_trip day4_trip day5_trip yesterday_trip
10 00001 7 0 8 0 10
20 00002 0 0 10 0 5 0

Advertisement

Answer

I think you just want

Is there any reason this did not work?

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement