I am trying to write a Select Statement. The data I need to get from Table A is Jobno, Stage, Empno, Labourhour, and Compqty, from Table B Jobno, Stage, Partshour and Startqty. Both Jobno and Stage must be equal in both tables. Any help would be greatly appreciated.
SQL Statement Help Please
Collapse
X
-
Please provide some more details on the structure of the tables A and B as some joining will probably be in order to correctly pull the dataset that you need. Specifically, your Primary Keys and Foreign Keys in the tables will help.Originally posted by buddy1I am trying to write a Select Statement. The data I need to get from Table A is Jobno, Stage, Empno, Labourhour, and Compqty, from Table B Jobno, Stage, Partshour and Startqty. Both Jobno and Stage must be equal in both tables. Any help would be greatly appreciated. -
The Primary Key is Jobno, it links all my tables. I'm sorry but I don't know what a foreign key is. This is only my second day with SQL queries.Originally posted by davefPlease provide some more details on the structure of the tables A and B as some joining will probably be in order to correctly pull the dataset that you need. Specifically, your Primary Keys and Foreign Keys in the tables will help.Comment
-
Try something along the lines ofOriginally posted by buddy1The Primary Key is Jobno, it links all my tables. I'm sorry but I don't know what a foreign key is. This is only my second day with SQL queries.
Code:select a.Jobno, a.Stage, a.Empno, a.Labourhour, a.Compqty, b.Partshour, b.Startqty from A a inner join B b on a.Jobno=b.Jobno
Comment
-
what's the error showing up?Originally posted by buddy1Thanks for the try but it's still not working.
Code:select a.Jobno, a.Stage, a.Empno, a.Labourhour, a.Compqty, b.Partshour, b.Startqty from TableA a inner join TableB b on a.Jobno=b.Jobno
Comment
Comment