Thread: grouping

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0

    grouping


    I keep getting this error and i do not understand it could someone please help?!!

    >>>>>>>>>> THE CODE <<<<<<<<<<<<<<<<

    Set rstGetRows = cnnGetRows.Execute("SELECT TYPE,SUPPLIERID,CATEGORYID,QUANTITYPERUNIT,UNITPRICE,PICTURE,DESCRIPTION,PRODUCTNAME FROM tbl_PRODUCTS WHERE CATEGORYID ="&ID&" GROUP BY TYPE")
    arrDBData = rstGetRows.GetRows()
    <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
    <%
    iRecFirst = LBound(arrDBData, 2)
    iRecLast = UBound(arrDBData, 2)
    iFieldFirst = LBound(arrDBData, 1)
    iFieldLast = UBound(arrDBData, 1)
    %>
    <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
    <%
    x = 0
    ' Loop through the records (second dimension of the array)
    For I = iRecFirst To iRecLast
    ' A table row for each record
    Response.Write "<tr><td colspan='9'><hr></td></tr><tr><TD bgcolor='#ffffff'><IMG alt=''border='0'src='"& arrDBData(6,x)&" '>"
    x=x+1
    ' Loop through the fields (first dimension of the array)
    For J = iFieldFirst To iFieldLast
    ' A table cell for each field
    Response.Write " </td>" & vbCrLf & "<td><font face='arial'size='2'><b>" & arrDBData(J, I) & "</b></font></td>" & vbCrLf
    Next ' J
    Response.Write "<td><a href='cart.asp'><img src='buynow.gif'></a></td></tr>" & vbCrLf
    Next ' I

    >>>>>>>>>>>>>>>> THE ERROR <<<<<<<<<<<<<<<<<


    Microsoft JET Database Engine error '80040e21'

    You tried to execute a query that does not include the specified expression 'SUPPLIERID' as part of an aggregate function.
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538
    There is an error in your sql statement, it is not related to java.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0

    sql


    thanks, i don't like sql s-q-l s-u-x !!!!
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538
    bah, you shouldn't criticize what you don't know
  8. #5
  9. I played Richard the Third
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Den Haag, Netherlands
    Posts
    122
    Rep Power
    11
    Nono

    SQL is great (because it's an industrial standard), it's that stuff around your SQl-statements that's not so great (and not a standard-not even a company standard).
    Now is the winter of our discontent made glorious summer by this son of York.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0

    SQL


    I hear ya, just getting the errors and not being ale to fnd them is discouraging. I guess it will happen less and less as time goes by.
  12. #7
  13. I played Richard the Third
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Den Haag, Netherlands
    Posts
    122
    Rep Power
    11
    SELECT TYPE,COUNT(*) FROM tbl_PRODUCTS WHERE CATEGORYID ="&ID&" GROUP BY TYPE

    or

    SELECT TYPE,SUPPLIERID,CATEGORYID,QUANTITYPERUNIT,UNITPRICE,PICTURE,DESCRIPTION,PRODUCTNAME FROM tbl_PRODUCTS WHERE CATEGORYID ="&ID&"

    but not both

    try this:
    http://www.sqlcourse.com/intro.html

    Good luck
    Now is the winter of our discontent made glorious summer by this son of York.
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0
    thanks, i have another question, if you would like to help?
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0
    ok, here it goes, am trying to make a site for puchasing merchandise and I am not sure how to go about making the shopping cart. I think it should be a dynamically created database table that gets populated as the user picls items and then gets destroyed after checkout.
    would that be the rigtht way to do that?
  18. #10
  19. I played Richard the Third
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Den Haag, Netherlands
    Posts
    122
    Rep Power
    11
    Your problem is that you need to store data about a user accross several webpages.

    My first question to you is, when do you know when your visitor checkes out? He does not have to do that the way you want, he could just close the page (our his Windows might crash). You need routines to check things like that.

    Wy do you want to delete the database-table after the user logged out? To my oppinion this is valuable information for your company/site and you should keep it stored somewhere.

    Don't make a table for every new visitor, adding vistor-records in a existing table is much faster and cleaner.

    I f would have to do something like that, I would use an Enterprise Java Bean (EJB)in a J2EE enviroment together. But that is quite complicated to learn and your system might not support the use of java. Judging to the code you posted, you are using somekind of VB, ASP or the like. I'm sure VB/ASP supports somekind of datapersistancy analogous to a EJB.
    Now is the winter of our discontent made glorious summer by this son of York.
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    21
    Rep Power
    0
    Thank you for your input
    I am trying to find the best way to do this
    I am able to write java classes and methods and I was becoming pretty comfortable with java but I'm not really sure how to develop web pages with java on windows 2000 so i just jumped into asp and the learning curve thing is in effect. Asp has session variables and some other global stuff, I guess I can use them.
    How then would I know when 'NOT' to show the items in the cart? Suppose the user leaves the sight and comes back another day, should the items still be there?
    Maybe each Session should be a unique session?
  22. #12
  23. I played Richard the Third
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Den Haag, Netherlands
    Posts
    122
    Rep Power
    11
    I think you need to clarify these things with whomever you are doing this for. I suggest you make some usecases (www.uml.org). This way you can get all the things your site is expected to do, sorted out.

    What you need, in my oppion is a "session-object" that is created for every time a visitor signes on to your site. This session-object then has a unique user-id and communicates with the database. It is responsible for retrieving an storing any relevant data (not only items, but also things like visitor count, email adress etc). When the visitor leaves the site, the session-object is destroyed, but only after it updated the database. The next time the same visitor comes by, a new session is made and it again reads from the database.

    I can image asp/Billie Gates has made some template you can use?
    Now is the winter of our discontent made glorious summer by this son of York.

IMN logo majestic logo threadwatch logo seochat tools logo