|
| |
|
|
William Angold
Posts: 4 Joined: 7/5/2002 Status: offline
|
SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/5/2002 15:11:52
Could anyone tell me what is wrong with this query fp_sQry=" SELECT COUNT(ID) , * FROM jobs" I get this error Database Results Error Description: [Microsoft][ODBC Microsoft Access Driver] Cannot group on fields selected with ' *' . Number: -2147217900 (0x80040E14) Source: Microsoft OLE DB Provider for ODBC Drivers Are there any ways around this Thanks William
|
|
|
|
porsche944
Posts: 366 Joined: 3/6/2002 From: Regina Canada Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/5/2002 17:26:21
This is yours: fp_sQry=" SELECT COUNT(ID), * FROM jobs" this is what i think: fp_sQry=" SELECT COUNT(ID) FROM jobs" I am not very god with SQL but i did manage to get my count query going a short while ago This will count the number of jobs you have in the database.(I think)
< Message edited by porsche944 -- 7/4/2002 5:27:35 PM >
|
|
|
|
ASPPlayground
Posts: 122 Joined: 6/25/2002 From: Toronto, Canada Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/5/2002 17:58:21
in this case you will need correlated subquery. Like this: " SELECT * , (SELECT Count(ID) FROM jobs) FROM jobs" but this is cumbersome because you will count all rows again and again. I will suggest that you use two separated queries for that.
_____________________________
Samuel Chou ASPPlayground.NET Developer
|
|
|
|
William Angold
Posts: 4 Joined: 7/5/2002 Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/6/2002 5:08:31
I may be being stupid but how would I use the statement " SELECT * , (SELECT Count(ID) FROM jobs) FROM jobs" To shop the number from the count(id) part of the statement. I want to use it in an if then statement William
|
|
|
|
William Angold
Posts: 4 Joined: 7/5/2002 Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/6/2002 5:14:06
I want to be able to use the count staement so that if it is 0 a form will be displayed if not the records from the select * will be displayed. William
|
|
|
|
William Angold
Posts: 4 Joined: 7/5/2002 Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/6/2002 10:24:56
Ho do you wirite HTML in the place where " No records Exists" is. When I try doing anthing it comes up with an error. DO you encase it in " " . William
|
|
|
|
no_mac_jack
Posts: 295 From: Washington state, USA Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 7/7/2002 1:25:17
You should be able to put HTML in there, but you have to replace each double quote (" ) with two in a row so that you don' t throw off the ASP coding that' s printing it. For example, this... <p align=" center" > would become this... <p align=" " center" " > Also, sometimes it will only let you enter a certain number of characters. However, this can usually be overcome if you write out the code in notepad or something and then copy & paste it. Lastly, your code all has to be on one line. Let me know if it' s still giving you trouble...Good luck! ~no_mac_jack
|
|
|
|
SilverDragon
Posts: 1 Joined: 10/10/2003 Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 10/10/2003 9:32:52
You could try the following code: if not myrecordset.eof then response.write "All The HTML code you want here!" else response.write "NO DATA RETURNED FROM DATABASE" end if I think that is what you are trying to do.....
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: SELECT COUNT AND THE OTHER FIELDS IN DATABASE - 10/10/2003 12:43:51
I have used a META Redirect in the "No records returns" spot and it works. Redirect to a form page.
_____________________________
http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|