Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-09-06 : 09:58:22
|
| Charles writes "select order_number, select sum (email_id) as [email_total] from t_email_log where email_id=233from t_invoice where invoice_number=655826I get an error when I execute this, but do you see what I'm trying to do? I'm trying to get a total from the t_email_log table and put the result in the query on the t_invoice table. If you can help me I would really appreciate it. Thanks!" |
|
|
lozitskiy
Starting Member
28 Posts |
Posted - 2002-09-06 : 10:10:57
|
| Try this way:select order_number, (select sum (email_id) from t_email_log where email_id=233) as 'email_total' from t_invoice where invoice_number=655826 -------------MCP MSSQL |
 |
|
|
ksw
Starting Member
24 Posts |
Posted - 2002-09-06 : 18:12:14
|
| You also probably want to change sum(email_id) to COUNT(email_id).--KSW |
 |
|
|
|
|
|