赞
踩
以下是先对表进行分页搜索,如搜索出来的结果是:
- SELECT *
- FROM (
- SELECT
- MOVIE_UID AS PICTURE_RELATE_ID,
- TITLE AS HOT_MOVIE_CACHE_NAME,
- PICTURE_PATH,
- START_TIME AS DATEINDATE_IN,
- ROWNUM AS rownumber,
- PICCACHEPATH
- FROM
- V_SOON_CINEMA
- WHERE
- MOVIE_STATE = '$arg_movieState'
- AND
- (PICTURE_TYPE ='$arg_pictureType'
- OR PICTURE_TYPE ='封面')
- )
- WHERE rownumber BETWEEN '$pageStar' AND '$pageEnd'
- ORDER BY PICTURE_RELATE_ID DESC
以下是先对表进行排序搜索,如搜索出来的结果是:
- SELECT * FROM
- (SELECT
- vsc.MOVIE_UID AS PICTURE_RELATE_ID,
- vsc.TITLE AS HOT_MOVIE_CACHE_NAME,
- vsc.PICTURE_PATH,
- vsc.START_TIME AS DATEINDATE_IN,
- PICCACHEPATH,
- ROWNUM row_num from
- (SELECT MOVIE_UID,TITLE,PICTURE_PATH,START_TIME,PICCACHEPATH FROM V_SOON_CINEMA vs
- WHERE
- MOVIE_STATE = '$arg_movieState'
- AND
- (PICTURE_TYPE ='$arg_pictureType'
- OR PICTURE_TYPE ='封面')
- ORDER BY vs.MOVIE_UID DESC) vsc
- WHERE ROWNUM<='$pageEnd'
- )vsca WHERE vsca.row_num >= '$pageStar'"
- SELECT CONCAT('¥',PRICE_STANDARD) as PRICE,to_char(SHOW_DETAIL_TIME,'HH24:MI') as SHOWTIME,
- SHOW_DATE,to_char(SHOW_DATE,'yyyy-mm-dd') as STR_DATE
- FROM V_SHOW_FILM_CINEMA
- WHERE FILM_UID = '$arg_moveId'
- AND SHOW_DETAIL_TIME > to_timestamp('$nowTime','yyyy-mm-dd HH24:mi:ss')
- ORDER BY SHOW_DATE,SHOWTIME
- SELECT DISTINCT T_CINEMA.CINEMA_ENTITY_ID,T_CINEMA.CINEMA_NAME
- FROM T_CINEMA,T_GROUP_CINEMA
- WHERE
- T_CINEMA.CINEMA_ENTITY_ID
- not in(SELECT CINEMA_ENTITY_ID FROM T_GROUP_CINEMA);
当T_GROUP_CINEMA表没数据依然可以查询出数据来
- select T_CINEMA.CINEMA_ENTITY_ID,T_CINEMA.CINEMA_NAME
- from T_CINEMA
- where not exists
- (select 1
- from T_GROUP_CINEMA
- where
- T_GROUP_CINEMA.CINEMA_ENTITY_ID=T_CINEMA.CINEMA_ENTITY_ID
- )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。