Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DBGrid Question: How can I implement this?- i think it´s noob question

Posted on 2004-08-31
4
Medium Priority
?
143 Views
Last Modified: 2010-04-05
Hi folks,

I have one table (table_1) which contains 4 fieds:
1) ID;
3) Product_Name;
2) Date;
4) Price.

I set a DBGrid to shows all my RECORDS related to some month (for example, August), ordering by date. So, it seems like:

==============================
ID----Product_Name---Date-----------Price
01---Product1----------01/08/2004---20.00
02---Product2----------01/08/2004---10.00
03---Product3----------01/08/2004---50.00
04---Product4----------02/08/2004---30.00
05---Product5----------02/08/2004---10.00
06---Product6----------05/08/2004---20.00
07---Product7----------07/08/2004---15.00
(...)
==============================

I need to put in another table(table_2 - 2 fields: Date and Amount)the amount of product´s price for DATE and shows it in another DBGrid. So, this second DBGrid will be something like:

==============================
Date------------Amount
01/08/2004----80.00
02/08/2004----40.00
05/08/2004----20.00
07/08/2004----15.00
(...)
==============================


How can i implement this? I am using ADO components to connect into my MS Access database.

Best regards.
0
Comment
Question by:joelsilva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 120 total points
ID: 11948973
use a tadoquery as dataset with a select like

select Date, sum(price) from yourtablename group by date

btw. what means noob?

meikl ;-)
0
 

Author Comment

by:joelsilva
ID: 11949147
Hi Kretzchmar... How´ve you been friend?

"Noob" means something related to NOVICEs.

Ok... You got it again. Now my first DBGrid seems like:

==============================
Date------------Price
01/08/2004----80.00
02/08/2004----40.00
05/08/2004----20.00
07/08/2004----15.00
(...)
==============================

So, the first QUESTION is done.

The second question in this TOPIC is:

How could i INSERT in a new TABLE the new information that is in my DBGrid (as i mentioned) now and shows it in another DBGrid?

Did you get it? In the first DBGrid i just see the RESULTs from a SELECT instruction. I´d like that these results be POST in another TABLE (table_2) and i´d like to see them in another DBGrid.

Thank you for now, friend.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11949274
also this can be done easily

use again a adoquery with a statement  like

insert into yourtable2name (Date,amount) select Date, sum(price) from yourtable1name group by date

use the execsql method for this statement

hope i understand this q correct

meikl ;-)

0
 

Author Comment

by:joelsilva
ID: 11949297
You got it man!!! You are a STAR!!!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question