asp/sql looping problem



i am new to asp/sql and of course, i have some problems with it.

please let me explain:
i have a problem with a sql result and its output in asp

my sql result table looks like this

city date payment total
================================================
city1 1/1/2007 Visa 123.32
city1 1/1/2007 Mastercard 23.30
city1 1/1/2007 AMEX 40.30
city1 1/2/2007 Mastercard 12.30
city1 1/2/2007 AMEX 234.20
city2 1/1/2007 Visa 111.11
city2 1/1/2007 AMEX 222.22
city2 1/3/2007 Visa 233.33
city3 1/1/2007 Visa 123.23
city3 1/1/2007 Mastercard 45.34
.....
and so forth


there are 3 fix payment options I want to show always: Visa, Mastercard
and AMEX.

I would like to output this result table shown before as followed in
asp:

First sorted by city, then date, and then always followed by 3 fixed
columns for the payment types

City1 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 123.32 23.30 40.30
1/2/2007 - 12.30 234.20

next city

City2 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -


next city

City3 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -


I tried it with looping while checking if date and city changed.
however, every time i try it, i can't show it properly like the way i
want it.

Please, can somebody help?

If you need more information, please let me know.
thank you so much.

.



Relevant Pages

  • Re: Adding new records with 3 relationships
    ... You are building the SQL ... A primary key defines a record as a unique entity. ... A City is a city regardless of location. ... Dim MyRS, MyBldg As DAO.Recordset ...
    (microsoft.public.access.queries)
  • Re: Question about Grouping in SQL!!
    ... It is called "derived tables" and was introduced in SQL Server 6.5, as per the ANSI SQL -92 standard. ... >> to pick out the minimum price per city. ... >> inner join Hotel h ...
    (microsoft.public.sqlserver.programming)
  • Re: Cant run a query - can anyone help?!
    ... be invited to which contains the city, venue name, date and times they ... You'll have to post the Where clause of your query SQL. ... If the value in the [Suggested Training Venue] field is one of those ...
    (microsoft.public.access.queries)
  • Re: XML vs SQL CE
    ... I have a 42,508 row table in SQL CE that holds Zip Codes, City, State used ... > with the relative speed of searches on an indexed field? ...
    (microsoft.public.pocketpc.developer)
  • RE: How to combine two queries into one?
    ... I group both by name and city,because the field city is ... the sql view platform to put in your sql, it appeared not as I wanted, ... because after running the query, it turned out with records not with unique ... lists of provinces and the total account balance ...
    (microsoft.public.access.queries)