Forums
This topic is locked
relational database problem
Posted 14 Dec 2002 17:53:00
1
has voted
14 Dec 2002 17:53:00 Simon Jones posted:
Ok...I have a database which links together two tables.. these are userAccounts and userPhotos. I have a voting system up and running... but my problem is that when i upload a new picture the voteCOUNT and voteVALUE (used to calculate an average) are set to 0 as they should... the problem is, is that I cannot get the index page to display when the vote values are null. I get the dreaded 800AOBCD error. As the averages arent shown on new submissions anyway a simple 'Show Region If Recordset Is Not Empty' would not do anything (as there is nothing to hide).
My only clue is that it could be the SQL statement.. which is:
SELECT a.*, b.*, b.voteVALUE/b.voteCOUNT
FROM userAccounts a, userPhotos b
WHERE a.username = b.username
ORDER BY userPhotoID desc
sorry if my problem isnt clear..
it's really bugging me.
I have another similar problem to this on another page.. but I'll leave it to another time.
Replies
Replied 14 Dec 2002 21:23:42
14 Dec 2002 21:23:42 Dave Clarke replied:
Hi
This maybe because you can't divide 0 by 0, try a default value of 1 for both fields which will give an answer of 1 and then subtract 1 to get the real figure.
((b.voteVALUE/b.voteCOUNT)-1)
Only an idea, let me know if it works.
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
This maybe because you can't divide 0 by 0, try a default value of 1 for both fields which will give an answer of 1 and then subtract 1 to get the real figure.
((b.voteVALUE/b.voteCOUNT)-1)
Only an idea, let me know if it works.
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 14 Dec 2002 22:19:03
14 Dec 2002 22:19:03 Simon Jones replied:
hey.. thanks for your input.
this is a very good idea but it doesnt work yet.
working out the average and taking away 1 will not give you the correct answer...
for instance:
voteVALUE=11
voteCOUNT=3
11/3 = 3.6666666666666666667
3.666666666667 - 1 = 2.66666667
if we test the voteCOUNT as it should be (2) we get 11/2 = 5.5
so it doesnt work ;(
ive tried coming up with other SQL but it all ends up with it dividing by zero again <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
any suggestions ??
Edited by - simon_himself on 15 Dec 2002 03:32:57
this is a very good idea but it doesnt work yet.
working out the average and taking away 1 will not give you the correct answer...
for instance:
voteVALUE=11
voteCOUNT=3
11/3 = 3.6666666666666666667
3.666666666667 - 1 = 2.66666667
if we test the voteCOUNT as it should be (2) we get 11/2 = 5.5
so it doesnt work ;(
ive tried coming up with other SQL but it all ends up with it dividing by zero again <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
any suggestions ??
Edited by - simon_himself on 15 Dec 2002 03:32:57
Replied 15 Dec 2002 03:31:40
15 Dec 2002 03:31:40 Simon Jones replied:
voteVALUE should have read 11 <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
oh well... i cant think of anything.
here is another problem I have though..
in the detail page for each photo... I have a 3 linked tables: userAccounts, userPhotos, feedbackPhotos
I get an error message if there is no feedback in the database.. but what i would like is that it just doesnt show any feedback if there isnt any. instead when there is no feedback it returns an empty recordset <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
any suggestions?
oh well... i cant think of anything.
here is another problem I have though..
in the detail page for each photo... I have a 3 linked tables: userAccounts, userPhotos, feedbackPhotos
I get an error message if there is no feedback in the database.. but what i would like is that it just doesnt show any feedback if there isnt any. instead when there is no feedback it returns an empty recordset <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
any suggestions?
Replied 15 Dec 2002 05:09:26
15 Dec 2002 05:09:26 Dave Clarke replied:
For the feedback thing, have it default to "Sorry there have been no comments" or something, so that it doesn't come up with an empty recordset but there is still no feedback.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 15 Dec 2002 16:55:31
15 Dec 2002 16:55:31 Simon Jones replied:
I'll give it a go.
thanks.
thanks.