Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *,
- (SELECT TOP 1 url
- FROM [dbo].[tbl_images] i INNER JOIN
- [dbo].[tbl_images_links] l ON i.id = l.id_image
- WHERE obj_type = \'news\' AND l.obj_id = t .id
- ORDER BY main_image DESC)
- AS image_url,
- (SELECT TOP 1 outsource_code, date_insert
- FROM [dbo].[tbl_videos] AS v
- INNER JOIN [dbo].[tbl_videos_links] vl ON v.id = vl.id_video
- WHERE vl.obj_id = t.id)
- AS video_code, video_date_insert
- FROM dbo.tbl_news AS t
- WHERE id_theme IS NOT NULL
- ORDER BY id OFFSET ' . $offset . ' ROWS
- FETCH NEXT ' . $limit . ' ROWS ONLY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement