![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
Add all fields in table
I have this table and its got a field name called value.
I would like to add up all the values and then purge it from the database. any suggestions? Thank you werner |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Using SQL:
SELECT SUM(value) FROM table DELETE FROM table (assuming "purge it" means "purge everything") |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 4
![]() |
TRUNCATE can also be used (at least in mysql) to remove all rows; it also resets auto-incrementing fields.
__________________
:wq |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
Thank you for your help! Im not using SQL though. ive just got an .dbf database. I just want to add all the records in a certian field and then purge them to a backup database.
Thank you for your swift response! I really appreciate your help Werner |
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
The extension "DBF" is apparently used by a number of different database applications. Which one are you using?
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
dbaseIV
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That's roughly fifteen years old, and uses its own proprietary query language, as opposed to the industry standard, SQL. I suggest a more recent DB application - MySQL or PostgreQL, perhaps? Of course, if you're tied in to this specific database software, you'll need to learn the query language. I couldn't find much on it myself - good luck.
![]() |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
thanks for your help. I think i should start using SQL. is there any forums i can join to find out about how to construct an sql database and where to find a free sql program. how do you start in sql? i dont know anything about sql.
Thank you for all your help thus far |
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
OK, let's start from the beginning. SQL stands for Structured Query Language, and is the language you need to know when working with databases. Most database software understands SQL.
There are two main things you need to do with databases: retrieve and manipulate information. SQL provides ways to do both. To retrieve information: SELECT forename, surname FROM people WHERE person_id > 10 ORDER BY surname; Now imagine we have a table with three columns: person_id, forename and surname. How would we put something in there? INSERT INTO people VALUES (4, "John", "Smith"); I suggest you pick up a book on SQL to find out all the different things you can do with it. To use it, you'll obviously need some database software. As I mentioned earlier, MySQL and PostgreSQL are two of the best. Download one of them and install it, and if you have any problems, let us know. |
|
|
|
|
|
#10 |
|
Newbie
Join Date: Mar 2006
Posts: 10
Rep Power: 0
![]() |
I was on the net reading up on sql language and i think it is a very powerfull language. i love building programs in delphi using databases. but i do not know waht database to use since dbase and bde is no longer supported and the growth limit is only 2GB wich is small. I would like to know what database structure to use and what opensource program can i use to construct the database. also can i use acess to make one or is the database desktop in delphi sufficient and if so wich database format. can you see my predicament. thank you for your advice. i am going to buy a book on sql but i dunno how to integrate it with a delphi program ect. i am still a novice.
Thank you very much! Werner |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|