A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with field



 
 
Thread Tools Display Modes
  #1  
Old May 3rd, 2007, 04:32 AM posted to microsoft.public.access.tablesdbdesign
SF
external usenet poster
 
Posts: 15
Default Help with field

Hi,

I have a table for storing election result as below

CEID Autonumber
CE_CommuneID Foreign Key to Commune Table
CE_PartyID Number Foreign Key to Party Table
CE_NumberOfVote Text
CE_NumberOfSeat Text

I use Text filed type for CE_NumberOfVotes and CE_NumberOfSeat as I want
also to display "No Candidate" in place of CE_NumberOfVote. Now I am facing
a problem of summarize the NumberOfVote and NumberOfSeat.

Could someone advice on the table structure

SF


  #2  
Old May 3rd, 2007, 08:55 AM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default Help with field

hi,

SF wrote:
CE_NumberOfVote Text
CE_NumberOfSeat Text
I use Text filed type for CE_NumberOfVotes and CE_NumberOfSeat as I want
also to display "No Candidate" in place of CE_NumberOfVote. Now I am facing
a problem of summarize the NumberOfVote and NumberOfSeat.

Make it a Long Integer field and allow Null. If you want to store "No
Candidate" store Null, or if you need Null to indicate no entry, use a
magic number, e.g. -666.

So you can sum it

SELECT Sum(CE_NumberOfVote)
FROM Table
WHERE NOT IsNull(CE_NumberOfVote)

or

SELECT Sum(CE_NumberOfVote)
FROM Table
WHERE CE_NumberOfVote -666


mfG
-- stefan --
  #3  
Old May 3rd, 2007, 11:41 AM posted to microsoft.public.access.tablesdbdesign
SF
external usenet poster
 
Posts: 15
Default Help with field

It works, Thank you

SF

"Stefan Hoffmann" wrote in message
...
hi,

SF wrote:
CE_NumberOfVote Text
CE_NumberOfSeat Text
I use Text filed type for CE_NumberOfVotes and CE_NumberOfSeat as I want
also to display "No Candidate" in place of CE_NumberOfVote. Now I am
facing a problem of summarize the NumberOfVote and NumberOfSeat.

Make it a Long Integer field and allow Null. If you want to store "No
Candidate" store Null, or if you need Null to indicate no entry, use a
magic number, e.g. -666.

So you can sum it

SELECT Sum(CE_NumberOfVote)
FROM Table
WHERE NOT IsNull(CE_NumberOfVote)

or

SELECT Sum(CE_NumberOfVote)
FROM Table
WHERE CE_NumberOfVote -666


mfG
-- stefan --



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.