romerom
01-25-2005, 04:40 AM
whats up everybody. I'm having an issue figuring out the correct sql query for some sorting logic for a website i just started helping out with.
i have two seperate mysql tables. each has a couple fields that are similar across the tables (for my intended purposes).
I can't sort by uniqueID because they have different id's obviously being in different tables. We do however, have a date/time stamp column in both tables that I'd like to sort by.
i came up with this.. but am not sure if the results i'm getting are accurate..
select artid,img,artist,date,info from cms_artists where info !='NULL' union select articleid,img,subject,date,text from cms_articles order by date desc limit 10;
does that look right?
i have two seperate mysql tables. each has a couple fields that are similar across the tables (for my intended purposes).
I can't sort by uniqueID because they have different id's obviously being in different tables. We do however, have a date/time stamp column in both tables that I'd like to sort by.
i came up with this.. but am not sure if the results i'm getting are accurate..
select artid,img,artist,date,info from cms_artists where info !='NULL' union select articleid,img,subject,date,text from cms_articles order by date desc limit 10;
does that look right?