A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query to extract data in a specified format



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2005, 09:47 PM
sattaluri
external usenet poster
 
Posts: n/a
Default Query to extract data in a specified format

I am new to SQL and need help in extracting some data from a table.

My table has the following data --

FUND_ID BEGIN_DATE END_DATE FEES
50 19910101 19930830 0.5%
50 19930831 19980429 0.6%
50 19980430 20000228 0.7%
50 20000229 20030331 0.72%
51 19620930 19950330 1.2%
51 19950331 19990929 1.3%
51 19990930 20031230 1.25%
51 20031231 20050130 1.4%
51 20050131 20050331 1.5%
52 19960531 19971129 0.2%
52 19971130 19990530 0.25%
52 19990531 20010530 0.3%

The above dates are stored as numbers in the database.

My output should be --


FUND_ID JAN-94 FEB-94 MAR-94.....APR-01 MAY-01 JUN-01....JAN-03
FEB-03 MAR-03......JAN-05 FEB-05 MAR-05
50 (0.6/12)
(0.6/12)(0.6/12)..(0.72/12)(0.72/12)(0.72/12).(0.72/12)(0.72/12)(0.72/12)..-- -- --
51 (1.2/12)
(1.2/12)(1.2/12)..(1.25/12)(1.25/12)(1.25/12).(1.25/12)(1.25/12)(1.25/12)..(1.4/12)
(1.5/12) (1.5/12)
52 -- -- -- (0.3/12) (0.3/12) --.....-- -- -- ..
-- -- --

  #2  
Old September 9th, 2005, 01:12 AM
KARL DEWEY
external usenet poster
 
Posts: n/a
Default

How do you expect to get 12 separate monthly figures out for FUND_ID 50 with
only 4 records?

The percent sign should only be used as a a label and not in data unless it
is text like a sentence.
Dates need to be in datetime fields, not as a number. You will need to
convert your dates like --
SELECT Table18.FUND_ID,
DateSerial(Left([BEGIN_DATE],4),Right(Left([BEGIN_DATE],6),2),Right([BEGIN_DATE],2))
AS [BEGIN],
DateSerial(Left([END_DATE],4),Right(Left([END_DATE],6),2),Right([END_DATE],2)) AS [END], [FEES]/100 AS FEE
FROM Table18;

"sattaluri" wrote:

I am new to SQL and need help in extracting some data from a table.

My table has the following data --

FUND_ID BEGIN_DATE END_DATE FEES
50 19910101 19930830 0.5%
50 19930831 19980429 0.6%
50 19980430 20000228 0.7%
50 20000229 20030331 0.72%
51 19620930 19950330 1.2%
51 19950331 19990929 1.3%
51 19990930 20031230 1.25%
51 20031231 20050130 1.4%
51 20050131 20050331 1.5%
52 19960531 19971129 0.2%
52 19971130 19990530 0.25%
52 19990531 20010530 0.3%

The above dates are stored as numbers in the database.

My output should be --


FUND_ID JAN-94 FEB-94 MAR-94.....APR-01 MAY-01 JUN-01....JAN-03
FEB-03 MAR-03......JAN-05 FEB-05 MAR-05
50 (0.6/12)
(0.6/12)(0.6/12)..(0.72/12)(0.72/12)(0.72/12).(0.72/12)(0.72/12)(0.72/12)..-- -- --
51 (1.2/12)
(1.2/12)(1.2/12)..(1.25/12)(1.25/12)(1.25/12).(1.25/12)(1.25/12)(1.25/12)..(1.4/12)
(1.5/12) (1.5/12)
52 -- -- -- (0.3/12) (0.3/12) --.....-- -- -- ..
-- -- --


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when running Query, but not Report Blaze Running & Setting Up Queries 29 September 9th, 2005 05:40 AM
Unable to have multiple queries feeding a single report PZ Straube Setting Up & Running Reports 15 June 15th, 2005 08:16 AM
query data from mixed format field Susan M Running & Setting Up Queries 6 January 31st, 2005 03:55 PM
extract only pertinent data from query to use in report Linda Setting Up & Running Reports 1 November 19th, 2004 05:57 PM
SQL view of messed up action queries Kendra Running & Setting Up Queries 2 August 31st, 2004 09:53 PM


All times are GMT +1. The time now is 02:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.