SQL SELECT across two tables

Posted by Brett Spurrier on Stack Overflow See other posts from Stack Overflow or by Brett Spurrier
Published on 2010-03-25T20:22:27Z Indexed on 2010/03/25 20:33 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

Hi there, I am a little confused as to how to approach this SQL query.

I have two takes (equal number of records), and I would like to return a column with which is the division between the two.

In other words, here is my not-working-correctly query:

SELECT( (SELECT v FROM Table1) / (SELECT DotProduct FROM Table2) );

How would I do this? All I want it a column where each row equals the same row in Table1 divided by the same row in Table2. The resulting table should have the same number of rows, but I am getting something with a lot more rows than the original two tables.

I am at a complete loss. Any advice?

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql