Viewing 15 posts - 136 through 150 (of 291 total)
See if this script will help:
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=1320
James.
June 15, 2007 at 10:30 am
Your welcome. Glad I could help.
James.
June 15, 2007 at 9:53 am
Your query doesn't match (table name wise) with the tables you posted. Assuming that "WebRequest" = "WebSummit" and "TownList" = "Town" I think the following will work:
SELECT distinct month(dateofrequest) [month],...
June 15, 2007 at 9:50 am
use an OUTER join:
parent left OUTER Join child on parent.key = child.key
that will tell sql to take everything from the LEFT table, parent even when nothing in the right, child table...
June 15, 2007 at 9:40 am
Test @@ERROR instead of the return code. For example the following will error on the second insert command and print an error message:
--create test table with unique column
if object_id('t') is...
June 15, 2007 at 9:23 am
And you tried:
From tbl_prnt tp Left outer Join tbl_chld tc on tp.key = tc.key
June 15, 2007 at 9:04 am
When you track it down please post final solution. Looking at what I posted other than maybe an ambiguous column name/reference I would think it should work. But I'm a...
June 15, 2007 at 8:29 am
You probaby would get a faster response if you posted in one of the T-SQL sections. However, assuming your range field is varchar and looks something like '100-200' the following...
June 15, 2007 at 8:01 am
I think this will do what you want:
Select name, [group], [date], sum(balance), sum(cost), sum([X Pay]),sum([Y Pay])
from (Select tp.name, tp.[group], tp.[date], tp.balance, tp.cost,
Sum(case when tc.pay_type = 'X' then tc.payment else...
June 15, 2007 at 7:35 am
Since you did not post the table definition, nor the actual error message it is very difficult to help. The following test code works fine under my SQL 2000 SP4:
June 14, 2007 at 8:56 am
Do you plan to do this in Query Analyzer/SQL Stuido, a command line script, or an application? I would think that Query Analyzer would be the best bet but it...
June 14, 2007 at 7:43 am
I also wear multiple hats, DBA, Database Designer and application developer, so I get to experience multiple points of view. Of course being a Jack of all Trades has the draw...
June 14, 2007 at 7:24 am
Try this (Though I have made a lot of assumptions about your data, including that you really didn't need to do a lot of the joins you were doing to...
June 13, 2007 at 11:07 am
After rereading your last post I saw that you wanted to be able to join the sales and product tables, I'm assuming you want the get additionall information about the...
June 13, 2007 at 9:57 am
Unless I'm missing something the following should do exactly what you asked for "sales row with the latest date for each product":
select productcode, max(date)
from sales
group by productcode
...
June 13, 2007 at 9:28 am
Viewing 15 posts - 136 through 150 (of 291 total)