Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have an accounting table with enties with date, account & value.

 

ie:

 

Date Account Value

1/01/07 Petrol $500

2/01/07 Wages $400

1/02/07 Food $30

2/02/07 Wages $400

15/02/07 Food $20

 

i would like to create a view sorted by Account & Date (in months)

ie

 

Account Jan-07 Feb-07

Petrol $500 $0

Wages $400 $400

Food $0 $50

 

is this possible?

i know i can get dates into months by using 'dateserial(year(date),month(date),1) however i can't workout how to sort by date & account.

 

Any help would be greatly appreciated.

 

Thanks.

Posted (edited)

Are you trying to create a view in the database or in your application?

 

Are you trying to sort or filter your data?

Edited by amir100
Amir Syafrudin
  • 2 weeks later...
Posted

Amir100,

 

i'm trying to create a datatable from filtering data from the database.

 

I have one table with a series of accounts, and another table with entries.

what i want to acheive is a matrix generated from the entries table filtered by accounts as the rows, dates as the columns, and the values corresponding to these to be the data. Basically i'm creating a pivot table view. (AND i can acheive this by doing a pivot table within Access 2007, however i don't know how to save that as a view or to write the SQL to generate the same)

 

Thanks for any help you can provide

Posted

I get what you mean.

 

I did some pivoting to once in a while. In my experience, the first thing I should do is create the view in the database without the pivoting. That should be easier right?

 

You'll get something like:

 

Month Account

Jan-07 Petrol

Jan-07 Wages

Jan-07 Food

Feb-07 Petrol

Feb-07 Wages

Feb-07 Food

...

 

That would be your main view. The next step would be using that main view and filter them by month. This is where you'll get your sub views. After that you'll be joining the sub-views into a large table.

 

You'll create your main view in the database. Filtering and joining should be done in your application because the filtering should be dynamic.

 

That's what I usually do. That is of course a straight-forward solution.

 

Did you get the picture?

 

Btw, I'm Amir. Nice to meet you. :D

Amir Syafrudin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...