Click here to Skip to main content
15,907,687 members
Home / Discussions / Database
   

Database

 
QuestionPassing an array of integers to a stored procedure Pin
Luis Alonso Ramos22-Sep-05 7:05
Luis Alonso Ramos22-Sep-05 7:05 
AnswerRe: Passing an array of integers to a stored procedure Pin
Orina DCosta22-Sep-05 10:58
Orina DCosta22-Sep-05 10:58 
GeneralRe: Passing an array of integers to a stored procedure Pin
Luis Alonso Ramos22-Sep-05 17:11
Luis Alonso Ramos22-Sep-05 17:11 
GeneralRe: Passing an array of integers to a stored procedure Pin
Christian Graus22-Sep-05 17:24
protectorChristian Graus22-Sep-05 17:24 
GeneralRe: Passing an array of integers to a stored procedure Pin
Luis Alonso Ramos23-Sep-05 6:35
Luis Alonso Ramos23-Sep-05 6:35 
GeneralRe: Passing an array of integers to a stored procedure Pin
Christian Graus25-Sep-05 12:15
protectorChristian Graus25-Sep-05 12:15 
Questionselecting data from one table and copy them into another Pin
achrafus22-Sep-05 5:52
achrafus22-Sep-05 5:52 
AnswerRe: selecting data from one table and copy them into another Pin
Colin Angus Mackay22-Sep-05 6:55
Colin Angus Mackay22-Sep-05 6:55 
From your post I think your table structure looks something like this (I've tried to fill in the gaps with information that seems to fit the description - if this is not the case then a more accurate description would be more helpful)
Inhabitants
-----------
ID
Payment
-------
InhabitantsID    (Foreign key join to Inhabitants.ID)
Date
PaymentAmount
PostponedPayment
----------------
InhabitantsID    (Foreign key join to Inhabitants.ID)
UnpaidPeriod


Try this query
INSERT INTO PostponedPayment(InhabitantsID, UnpaidPeriod)
SELECT InhabitantsID, COUNT(*) AS UnpaidPeriod
WHERE p.PaymentAmount = 0
GROUP BY InhabitantsID

It will count all the periods unpaid for each inhabitant and insert it in the PostponedPayment table.

Does this help?


My: Blog | Photos

"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious


GeneralRe: selecting data from one table and copy them into another Pin
achrafus22-Sep-05 7:38
achrafus22-Sep-05 7:38 
QuestionSQL Server Reporting Reset Page count or use distinctcount() for page number Pin
bubberz22-Sep-05 5:12
bubberz22-Sep-05 5:12 
AnswerRe: SQL Server Reporting Reset Page count or use distinctcount() for page number Pin
bubberz22-Sep-05 7:58
bubberz22-Sep-05 7:58 
AnswerRe: SQL Server Reporting Reset Page count or use distinctcount() for page number Pin
bubberz22-Sep-05 11:02
bubberz22-Sep-05 11:02 
QuestionMs-Access Vs Sql-Server 2000 Pin
Naveed Kamboh22-Sep-05 4:37
Naveed Kamboh22-Sep-05 4:37 
AnswerRe: Ms-Access Vs Sql-Server 2000 Pin
miah alom22-Sep-05 5:14
miah alom22-Sep-05 5:14 
AnswerRe: Ms-Access Vs Sql-Server 2000 Pin
Luis Alonso Ramos22-Sep-05 7:16
Luis Alonso Ramos22-Sep-05 7:16 
GeneralRe: Ms-Access Vs Sql-Server 2000 Pin
Naveed Kamboh23-Sep-05 3:01
Naveed Kamboh23-Sep-05 3:01 
QuestionSelect Pin
NormBohana21-Sep-05 15:09
NormBohana21-Sep-05 15:09 
AnswerRe: Select Pin
Christian Graus21-Sep-05 15:38
protectorChristian Graus21-Sep-05 15:38 
AnswerRe: Select Pin
miah alom22-Sep-05 3:26
miah alom22-Sep-05 3:26 
QuestionStored Query in Access Pin
kornstyle21-Sep-05 8:53
kornstyle21-Sep-05 8:53 
AnswerRe: Stored Query in Access Pin
Christian Graus21-Sep-05 15:40
protectorChristian Graus21-Sep-05 15:40 
QuestionUpdate Pin
Illegal Operation21-Sep-05 2:29
Illegal Operation21-Sep-05 2:29 
AnswerRe: Update Pin
Christian Graus21-Sep-05 15:39
protectorChristian Graus21-Sep-05 15:39 
QuestionExpression column in a Datatable not evaluating Pin
convergence21-Sep-05 0:22
convergence21-Sep-05 0:22 
AnswerRe: Expression column in a Datatable not evaluating Pin
sreejith ss nair21-Sep-05 0:49
sreejith ss nair21-Sep-05 0:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.