Viewing 15 posts - 61 through 75 (of 116 total)
Now that I know the tables it's really getting confusing...
You have different bookings with 1:n transactions per booking. True? OK.
Now you're going to get...
March 2, 2006 at 11:48 am
Question: There's a HomeworkerID in both tables (tbl_hp_bookings and tbl_hp_bookings_transaction.) Why? Is it supposed to always be the same?
March 2, 2006 at 10:11 am
Unfortunately, I cannot test without the tables at hand. Can you script them (using QA) ? Now that we've gone that far, we should finish it up
March 2, 2006 at 7:59 am
?messy. I posted a solution there. That's really not how it's meant to be ....
March 2, 2006 at 7:02 am
Why the heck do you store the birthdate as varchar???
March 2, 2006 at 6:57 am
or
INSERT INTO Delete_Dup_Records
SELECT
D2.vid,
D2.vName,
D2.vAddress,
'tricky' + D2.vGroup ,
FROM Delete_Dup_Records D2
GROUP BY
D2.vid,
D2.vName,
D2.vAddress,
D2.vGroup
DELETE FROM Delete_Dup_Records WHERE vGroupName NOT LIKE 'tricky%'
UPDATE Delete_Dup_Records SET vGroupName = SUBSTRING(vGroupName,7,8000)
why not...
March 2, 2006 at 6:48 am
If you don't care using a loop ... this will do
DECLARE @affected INT
SET @affected = 1
WHILE @affected > 0
BEGIN
SET ROWCOUNT 1
DELETE FROM Delete_Dup_Records
FROM Delete_Dup_Records D
INNER JOIN (SELECT vid, vName,vAddress,VGroup
FROM Delete_Dup_Records...
March 2, 2006 at 6:18 am
is it actually a software? reading through the forums one can get the impression it's rather a nightmare
March 2, 2006 at 6:02 am
-- And an inline version of the above function (shoulf perform better)
CREATE FUNCTION udf_Calc_dtHWRevenue_02
(@dtminQuestion DATETIME)
RETURNS TABLE
AS
RETURN
(SELECT
BK.homeworkerid,
COALESCE(SUM(transactionamount),0) AS TransactionAmount
FROM tbl_hp_bookings_transactions BKT
INNER JOIN tbl_hp_bookings BK
ON BKT.bookingid = BK.bookingid
WHERE
BKT.TransactionDate >=...
March 2, 2006 at 5:32 am
-- A version with a table valued UDF, just to get the idea (NOT TESTED, care of performance)
CREATE FUNCTION udf_Calc_dtHWRevenue
(@dtminQuestion DATETIME)
RETURNS @tblBookingSum TABLE (HomeworkerID INT PRIMARY KEY,
TransactionAmount MONEY DEFAULT 0) ...
March 2, 2006 at 5:17 am
-- The basics for your special date range / just to clrify and test
DECLARE @dtmSome DATETIME,
@dtmStart DATETIME,
@dtmEnd DATETIME
SET @dtmSome = '20060223'
SET @dtmStart = CAST(CAST(DATEPART(yyyy,@dtmSome)AS CHAR(4)) + REPLACE(STR(DATEPART(mm,@dtmSome),2),' ','0') + '01'...
March 2, 2006 at 4:58 am
In terms of patience it was surely good exercise to write this procedure.
When I see 'one-size-fits-all' procedures like this I'd suggest you take a side...
March 1, 2006 at 5:43 pm
>SELECT ...., dbo.Initials ('TableName', TableId)<
That's what was asked for. If you prefer to replace it with a Sub-Select, this is simply different in terms of what you want -...
March 1, 2006 at 5:03 pm
Viewing 15 posts - 61 through 75 (of 116 total)