Sunday 15 April 2012

mysql - join 3 tables with sort -


I have 3 tables that I want to put together. A video table with an image table with all users' videos, images of all users and a camera table. I have a list of all images and videos and solving them

With prefix_videos table (videoid, users have ID, Cameraid, Videosize, date, delete, videolength, videoname) Prefix_cameras table with prefix_images table (imageid, user id, cameraid, imagesize, date, deleted, imagename)

(Userid, cameraid, ...)

Before this I only gave the video table so this query had given me what I needed:

  Prefix_videos.videoid, prefix_videos.videonam E, prefix_videos.videosize, prefix_videos Videodatetime, prefix_videos.videolength, prefix_cameras.cameraname using FROM prefix_videos INNER prefix_cameras (userid, cameraid) WHERE prefix_videos.deleted IS NULL and prefix_videos.userid = xxx ordered by prefix_videos.datetime DESC   

But now I am adding an image table

imageid / videoid, cameraid, imagesize / videosize, date (either from the image or video table), videoname / imagename

Because now I'm combining the image and video table to give a result, I'm not sure The In comes another inner join it here?

Here is the check for the other important part of the tap, the ability to order these entries through deleted entries and dates whether it comes from images or videos. Text after "

itemprop =" text ">

You can make two separate selections for video and image, and then make them one together with the union to bring dirty part you want after afaik way that