dalearyous
[H]ard|Gawd
- Joined
- Jun 21, 2008
- Messages
- 1,922
i come in and out of SQL and seem to forget it very quickly. anyway, example:
lets say i have a table with 2 columns: task code and description like so:
taskcode description
1 travel
2 meals
3 internet
my second table has taskcode and budget like so:
taskcode budget
1 500
2 100
3 50
i am doing a selec tstatement on the second table and would like my result to be:
taskcode description budget
my first attempt:
i get the result i want but there are duplicates obviously. i know i need to group by or aggregate but can't quite get it to work. thoughts?
lets say i have a table with 2 columns: task code and description like so:
taskcode description
1 travel
2 meals
3 internet
my second table has taskcode and budget like so:
taskcode budget
1 500
2 100
3 50
i am doing a selec tstatement on the second table and would like my result to be:
taskcode description budget
my first attempt:
Code:
select table2.taskcode, table1.description, table2.budget
from table1, table2
where table1.taskcode=table2.taskcode
i get the result i want but there are duplicates obviously. i know i need to group by or aggregate but can't quite get it to work. thoughts?