Selecting data from 2 tables

  • SELECT * FROM DocketTB,WorkshopTB WHERE DocketTB.Docket_Date = WorkshopTB.Date_Raised order by Docket_Date desc

    using the above works to a fashion but it adds them in 1 row!, how is the correct way to do the data row by row in date order. Hope this makes sense

  • Maybe something like this?WITH Data (col1, col2, col3, Docket_date) AS

    (

    SELECT col1, col2, col3, Docket_date FROM dbo.DocketTB ORDER BY Docket_Date DESC

    UNION ALL

    SELECT col1, col2, col3, Date_Raised FROM dbo.WorkshopTB ORDER BY Date_Raised DESC

    )

    SELECT * FROM Data ORDER BY Docket_date

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply