Answered
How to handle date in cfquery ?
Hello,
I have a query (qVIEW) which selects a date (which is one column in my table).
Now I want to loop thru the first query (qVIEW) and then do another query in it (qRate).
Actually my problem is with the qRate "where" statement. I want to put :
where "....and tbl_daily.adate= qVIEW.lastdate"
I added it (see below) but it is giving me error.
Am I putting this line wrongly?
Any help would be highly appreciated.
thx
<cfset locale =SetLocale("English (UK)")>
<cfquery name="qVIEW" datasource="mydb">
Select
tbl_view.name as myname,
tbl_view.lastdate as lastdate
from tbl_view
</cfquery>
<cfloop query="qVIEW">
<cfquery name="qRate" datasource="mydb">
select
tbl_daily.rate as dailyrate
from tbl_daily,tbl_names
where
tbl_names.names = '#qPL.myname#'
and tbl_names.id= tbl_daily.id
and tbl_daily.adate= qVIEW.lastdate <!--- THIS PART IS GIVING ME ERROR --->
order by tbl_daily.id desc
</cfquery>
</cfloop>
I have a query (qVIEW) which selects a date (which is one column in my table).
Now I want to loop thru the first query (qVIEW) and then do another query in it (qRate).
Actually my problem is with the qRate "where" statement. I want to put :
where "....and tbl_daily.adate= qVIEW.lastdate"
I added it (see below) but it is giving me error.
Am I putting this line wrongly?
Any help would be highly appreciated.
thx
<cfset locale =SetLocale("English (UK)")>
<cfquery name="qVIEW" datasource="mydb">
Select
tbl_view.name as myname,
tbl_view.lastdate as lastdate
from tbl_view
</cfquery>
<cfloop query="qVIEW">
<cfquery name="qRate" datasource="mydb">
select
tbl_daily.rate as dailyrate
from tbl_daily,tbl_names
where
tbl_names.names = '#qPL.myname#'
and tbl_names.id= tbl_daily.id
and tbl_daily.adate= qVIEW.lastdate <!--- THIS PART IS GIVING ME ERROR --->
order by tbl_daily.id desc
</cfquery>
</cfloop>