Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

I have below 2 queries and I want to combine them together.

sql database

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 game2d

game2d

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 57 posts

Posted 08 November 2015 - 05:14 PM

I need some help writing a sql query. I have below 2 queries and I want to combine them together.
 
Now I already tried 'union' but it doesn't work. 
 
I first want to print all results of query1 than at bottom of that I want to print all results for query2.
 
--Query#1
SELECT DISTINCT a.[rank], b.Description
    FROM CONTAINSTABLE(myTable, *, '"ra*'") AS a
        INNER JOIN myTable AS b ON a[key] = b.ID
             ORDER BY a.rank desc;
 
-Query#2
SELECT DISTINCT a.[rank], b.Description
    FROM FREETEXTTABLE(myTable, *, '"ra'") AS a
        INNER JOIN myTable AS b ON a[key] = b.ID
             ORDER BY a.rank desc;
 
 

Edited by game2d, 08 November 2015 - 05:18 PM.


#2 lespauled

lespauled

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts

Posted 09 November 2015 - 12:53 PM

union all


My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth