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 |
dzabor
Posting Yak Master
138 Posts |
Posted - 2014-02-13 : 15:44:35
|
I would like to find the first transaction_date with the criteria below and return all transactions after. i would need to use the seqn number since many of the transactions could occur on the same day. Ideas?SELECT c.MEMBER_TYPE, c.DATE_ADDED, h.ID, h.ACTIVITY_TYPE, h.TRANSACTION_DATE, h.UF_1, min (h.seqn)FROM history h inner join contact c on h.ID = c.IDWHERE h.history_TYPE = 'WEB' AND c.MEMBER_TYPE <> 'EMP' AND h.UF_1 LIKE 'book%' OR h.UF_3 LIKE '%Order%.pdf' |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-02-13 : 17:10:22
|
sample data expected output?http://www.sqlservercentral.com/articles/Best+Practices/61537/http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
dzabor
Posting Yak Master
138 Posts |
Posted - 2014-02-13 : 17:32:49
|
MEMBER_TYPE DATE_ADDED ACTIVITY_TYPE TRANSACTION_DATE UF_1 UF_3MEM 5/12/1995 WEB_ACCESS 1/10/2011 Book 4.1 Book_4.1.pdfMEM 5/12/1995 WEB_ACCESS 1/10/2011 Book 4.1 Book_4.1.pdfMEM 5/12/1995 WEB_ACCESS 1/10/2011 Book 4.1 Book_4.1.pdfMEM 9/27/1995 WEB_ACCESS 1/12/2011 Book User Guide for Service Managers Book-User-Guide-for-Service-Managers-01April2009-Research.pdfMEM 9/27/1995 WEB_ACCESS 1/12/2011 Book Control Practices Book-ControlPractices.pdfMEM 1/2/1996 WEB_ACCESS 1/13/2011 Book Products Brochure Book-Products.pdf |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-02-14 : 12:57:16
|
Please read the links I posted above.1. Your sample data is not runnable. It should be in a format that we can execute.2. You didn't post expected output based on that sample data. Or I can't tell what the expected output is. |
 |
|
|
|
|