Tuesday, 15 February 2011

MySQL - Passing a query condition to a view within a view -



MySQL - Passing a query condition to a view within a view -

i have created view uses view retrieve it's data.

this sec view queries table timestamp, , add together where status query of first view effects timestamp of sec view.

so query might (this doesn't work, gets across trying hope:

select * `view_1` `view_2.timestamp` >= '2014-06-01 00:00:00'

is there way modify clause of view used within view?

edit: create little clearer doing.

i using sub query, why having utilize sec view. can't have sub queries in mysql views, sub query in view. sub query view 1 able , dynamic where clause when querying first view.

view_1

select `case id`, `creation date`, case when `each_amount` > 1 "yes" else "no" end 'opened', [view_2] `creation end` <= now() , `first` = 1 order `creation date` desc

view_2

select t0.timestamp 'creation end', count(t0.ipaddress) each_amount, min(t0.first) 'first', `mappin` t0 t0.timestamp >= '2014-04-20 00:00:00' grouping code_2

my query of view_1 is

select * view_1

this query gets me mappin table on or after '2014-04-20 00:00:00', date alter in query of view_1.

you need bring together view_1 , view_2. like,

select * form view_1 bring together view_2 on view_1.id=view2.id view_2.timestamp` >= '2014-06-01 00:00:00';

mysql view

No comments:

Post a Comment