0

/
we have three table like follwing

</ weather=>
    id
    shop_id 
    temp_c
    datetime
shops=>
    id
    gstIncludedSales
    GST_Inc_Sales,
    gstFreeSales
transacion=>
    id
    transaction 
    total
    time
    transaction_date
    shopid

/ i have apply this query ...

select HOUR(transaction.time) as Hour ,TRUNCATE(sum(transaction.total),2) as Total_Sales,shops.gstIncludedSales as GST_Inc_Sales,shops.gstFreeSales as GST_Free from transaction,shops where transaction.shopid=shops.id and transaction.shopid=7 and transaction.transaction_date ='2015-05-25' group by hour ORDER BY hour DESC

/ i want to add one table also weather table with upper query with following result set ..

 SELECT temp_c FROM weather WHERE date(datetime)='2015-05-25' and shop_id=7

this result set i want .....=>

TotalSales |   GSTIncSales |  GSTFree  | Temp
           445454  |    4545       |  545      |  4

The problem is that temp not come from weather table...

2
Contributors
1
Reply
15
Views
2 Years
Discussion Span
Last Post by diafol
0

WHat are you trying to do with truncate? Truncate empties tables. Are you looking for a rounding function?

Also why 'shops.gstIncludedSales as GST_Inc_Sales' when you have that field in your table alreadY?

shops=>
id
gstIncludedSales
GST_Inc_Sales,
gstFreeSales

This looks mightily messed up to me.

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.