MySQL How to select mulipie rows then send to another query -


i hava table ,i can use

select `event_id` `event` 1 

to mulipie rows event_id , , put event_id in query

set @event_id = xxxx; select * from( (select `event_id`,`author_id`,`latitude`,`longitude`,`type`,`rate`,`description`,`photo_id`, unix_timestamp(`timestamp`) `timestamp`  `event`) `event`, (select count(*) `thumb_up_count` `thumb_event` `event_id` = @event_id , `thumb_state` = 1) `thumb_up_count`, (select count(*) `thumb_down_count` `thumb_event` `event_id` = @event_id , `thumb_state` = 2) `thumb_down_count`, (select ifnull((select `thumb_state` `thumb_event` `event_id` = @event_id , `user_id` = ?) , 0) `thumbed`) `thumbed`, (select count(*) `comment_count` `event_comment` `event_id` = @event_id) `comment_count` ) `event_id` = @event_id; 

i can use set @event_id = 0000; set event_id , how can put event_id select in query

if understoods, maybe need it's in clause:

where `event_id` in (select `event_id` `event` 1); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -