Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My database table

Id   email            pick-up   track
1   jhon@gmail.com     123       abc
2   jhon@gmail.com     234       abc
3   kart@gmail.com     324       xyz
4   kart@gmail.com     324       xyz
5   kart@gmail.com     657       xyz
6   navee@gmail.com    435       def
7   lake@gmail.com     879       def
8   jake@gmail.com     324       res
9   jake@gmail.com     324       res


I want to display these data as table format in my web page as below

Id   email            pick-up   track
1   jhon@gmail.com     123       abc
                       234       
2   kart@gmail.com     324(2)    xyz       
                       657       
3   navee@gmail.com    435       def
4   lake@gmail.com     879       def
5   jake@gmail.com     324(2)    res


What I have tried:

Help me to fix this, I am using having function but not getting result.
Posted
Updated 3-Jul-20 5:00am

1 solution

Save the id and email value from the first row that you display. Then as you read each item:
If the id and email match the saved values do not print the first two columns.
If they do not match then copy the new values to the saved items and print the first two columns.
Repeat ad nauseam.
 
Share this answer
 
Comments
Member 14880123 3-Jul-20 11:22am    
Thanks for your reply. did you try this? if yes will you share the code
Richard MacCutchan 3-Jul-20 11:54am    
Sorry, but my code is in Univac 1100 series assembler, so it would not make any sense to you. But the code is not exactly difficult; it is just a matter of storing a couple of values and adding an if/else block.
MadMyche 3-Jul-20 11:54am    
This is very common and I have done this many times; the code is rather easy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900