Wednesday, March 21, 2012

help on complex query

i need your help on a complex view
i have the following tables
* tblStats
categoryID
statDate
statUserIP
statVisits
statForms
*tblCategory
categoryID
category
i need the following output
categoryID category totalForms totalVisits statDate
10 Test 10 5
2004.11
10 Test 5 1
2004.12
10 Test 4 0
2005.1
20 Test 2 6 1
2004.11
20 Test 2 4 2
2004.12
20 Test 2 0 1
2005.1
important:
- distinct select on categoryID, statDate and UserIP
users which visited a category several times on the same date should
count only once for this date
- statDate should be shown in format year.month
can somebody help me on this view ?On Wed, 19 Jan 2005 22:52:47 +0100, Mike Schwarz wrote:
>i need your help on a complex view
(snip)
Hi Mike,
You're omitting several relevant details from your post. Please provide
the following:
* Table structure, posted as CREATE TABLE statements (including datatypes,
constraints, properties and indexes, but excluding irrelevant columns).
* Sample data, posted as INSERT statements
* Expected output (based on the sample data provided)
* And an explanation of the business problem you're trying to solve.
With these details, we can try to help you. Without them, we can only
guess.
See www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment