(select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_journal_volume_trail WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_journal_volume_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_journal_volume_token WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_ebook_volume_trail WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_ebook_volume_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_ebook_volume_token WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_issue_trail WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_issue_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_issue_token WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_article_trail WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_article_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_article_token WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_chapter_trail WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_chapter_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_chapter_token WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) union (select `user_id`, `to_ip`, `from_ip` from (select user_id, to_ip, from_ip FROM user_access_disease_corporate WHERE to_ip >=316600437ORDERBY to_ip ASC LIMIT 1) as `tjv` where `from_ip` <=316600437) limit 1
selectcount(*) as aggregate from `ebook_volume` as `ev` innerjoin `ebook` as `e` on `e`.`ebook_id` = `ev`.`ebook_id` leftjoin `ebook_access` as `ea` on `ea`.`content_type_id` = `ev`.`ebook_volume_id` and ((from_date <= CURDATE() and to_date >= CURDATE() and perpetual=0) or (from_date isnulland to_date isnulland perpetual=1)) and ea.content_type="v" innerjoin `year` as `y` on `y`.`id` = `ev`.`year_id` where `e`.`published` =1and `ev`.`is_uploaded` =1and `ebook_status` =1
select `ev`.*, `e`.`title`, `e`.`image_file_name` as `ebk_image_file_name`, `ea`.`content_type_id`, `ea`.`content_type_access_id`, (select concat(first_name,' ',last_name) from author as a where a.ebook_volume_id = ev.ebook_volume_id limit 1) as authors from `ebook_volume` as `ev` innerjoin `ebook` as `e` on `e`.`ebook_id` = `ev`.`ebook_id` leftjoin `ebook_access` as `ea` on `ea`.`content_type_id` = `ev`.`ebook_volume_id` and ((from_date <= CURDATE() and to_date >= CURDATE() and perpetual=0) or (from_date isnulland to_date isnulland perpetual=1)) and ea.content_type="v" innerjoin `year` as `y` on `y`.`id` = `ev`.`year_id` where `e`.`published` =1and `ev`.`is_uploaded` =1and `ebook_status` =1orderby e.title, cast(ev.volume_name as signed) ASC limit 12offset0