/
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...

Member Avatar for diafol

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.