Tim
Tim

Reputation: 337

Join two SQL queries where the second only returns one row and column

I have a query which returns a list of jobs in the following format:

JobName    Weight
-----------------
3484       2958
7843       6833
0065       6768

I also have another select query (looking at another table) which always returns the name of the current job being run.

Current_Job
-----------
0065

How can I combine these two queries to produce the following?

JobName    Weight      Current_Job
----------------------------------
3484       2958        0065
7843       6833        0065
0065       6768        0065

Thanks

Upvotes: 0

Views: 72

Answers (2)

Matt Whitfield
Matt Whitfield

Reputation: 6574

That would be

SELECT * 
  FROM Table1 CROSS JOIN 
       Table2

Upvotes: 4

podiluska
podiluska

Reputation: 51494

SELECT JobName, Weight, Current_Job
FROM (yourfirstquery) q1, (yoursecondquery) q2

Upvotes: 0

Related Questions