August 31, 2011 at 11:22 pm
this does make more sense to me..i will try the code..and get back to you..thanks for posting this,,,:-)
debra
September 5, 2011 at 2:43 am
sorry to come back again, but my problem is not getting solved.
Here is what i need to archive:
1) If last session MMC_PLACEMENT = LM_"YOUR CTA NUMBER" e.g. LM_1020 -- This order is attributed
2) If the last session MMC_PLACEMENT = DIRECT LOAD, REFERRING URL or FREE SEARCH see step 3, else -- This order is not attributed
3) Examine previous session until either.......
......MMC_VENDOR / MMC_PLACEMENT = Email / LM_"YOUR CTA NUMBER" -- This order is attributed.
or
.....MMC_VENDOR / MMC_PLACEMENT = Email | Not Email / Not LM_"YOUR CTA NUMBER" -- This order is not attributed.
The tables are as previous. please help me as I have no where else to go.
thanks,
debra
September 5, 2011 at 3:21 am
debra
please provide some test data that fully demonstrates your problem
in this format please:
INSERT INTO [dbo].[TMPDATA]([client_order_number], [order_date], [session_start_time], [mmc_vendor], [mmc_placement], [mmc_item])
SELECT N'H4246723', 20100813, 20100813111301, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111302, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111303, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111304, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111305, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111306, N'email', N'_bmuy', N'welcom' UNION ALL
SELECT N'H4246723', 20100813, 20100813111307, N'email', N'_bmuy', N'welcom' UNION ALL
Also we do really really need to see the result that you expect from the test data that you provide....also the logic.
regards
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 5, 2011 at 3:35 am
if i provide you the text file, would you be able to import that to do the logic? I really dont have the time to make it in this format.
September 5, 2011 at 3:45 am
...I dont have much time either.
looking again at your logic isnt this just a simple update along the lines of
UPDATE TMPDATA
SET order_attribution = 'Y'
WHERE (LEFT(mmc_placement, 2) = 'LM')
post the text file by all means..if I have time I may get around to looking at it
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 5, 2011 at 4:10 am
no that would update everything..while i want a.the last session time and b. if last session time placement = criteria i gave before then find the last session where mmc_placement = Lm_1225, and order that
September 5, 2011 at 4:19 am
nairdeepa (9/5/2011)
no that would update everything..while i want a.the last session time and b. if last session time placement = criteria i gave before then find the last session where mmc_placement = Lm_1225, and order that
in which case you had better post some data and expected results , as i suggested earlier.
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 5, 2011 at 6:04 am
thanks..
September 5, 2011 at 7:01 am
nairdeepa (9/5/2011)
thanks..
debra
....do we assume data is coming later?
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 5, 2011 at 8:13 am
Sorry I don't have the time to explain anymore. I know you are also busy. It's okay. I will find a way around.
Kind regards,
Debra
September 5, 2011 at 8:18 am
Debra
sorry that I have been unable to help you.
you mentioned a text file...if you care to post it I will try and take a look later.
kind regards
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 5, 2011 at 8:27 am
thanks for your help, i will post the file tomorrow if possible. else its okay. I will find a way around. I know I have been unable to explain. It's all my fault.
Kind regards,
Debra
September 5, 2011 at 1:21 pm
No, it's not your fault. Be assured, there are others following this thread just waiting for some sample data and expected results. Ready to use SQL code will explain much better what you're looking for than almost any verbal description. For an example how to post sample data please have a look at the first link in my signature.
It's just that we can't see what you see. All we have is what you post. Posting ready to use sample data, a brief description of the business rules (if not obvious) and the expected results is usually referred to as helping us to help you.
September 5, 2011 at 1:58 pm
thanks. i will follow this in future. just ran out of time this time.
regards,
debra
Viewing 14 posts - 31 through 43 (of 43 total)
You must be logged in to reply to this topic. Login to reply