Results 1 to 4 of 4

Thread: Formated output from Acces2000 - SQL

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395

    Formated output from Acces2000 - SQL

    Greetings,

    i have a few querries like the one below.

    SELECT [Statistics].[Year], [Statistics].[RoomType],
    SUM([Preis]*[Tage])/SUM([Tage]) AS [Avg Of Preis]
    FROM Statistics
    WHERE [Statistics].[RoomType]='4'
    GROUP BY [Statistics].[Year], [Statistics].[RoomType]
    ORDER BY [Statistics].[RoomType];

    how can I get an output for the field
    SUM([Preis]*[Tage])/SUM([Tage]) AS [Avg Of Preis]
    as an international format 00.00 (only 2 numbers after the decimalpoint?) in the moment I get n numbers after the DP

    many thanks
    Manfred

  2. #2
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    I am not sure that it works:

    Format(SUM([Preis]*[Tage])/SUM([Tage]),"00.00") will work in Excel. Maybe you should have a look into the format method. I never tried it with a SQL-command. If you got the solution please put it here as a post.

    Franky

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395
    Franky, nice try but did not work

    I can manipulate the output if I use the Query Builder (Property)
    but it does not show up in the sql statement.

    This methode I can use only for querries in the DB but I also have querries direct from a VB app.

    So this thread is still open.

  4. #4
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Ok, I read your code a little slower ...

    I know a solution:

    You have to put of course the result from SUM([Preis]*[Tage])/SUM([Tage]) AS [Avg Of Preis] to somewhere. It must be a field, correct? Format the result-field itself, this works for sure.

    If you put the code here I can look into it. Should be a 5 minute work.

    Franky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width