|
Author |
Message |
therapy
Junior WebHelper
Joined: 22 Jun 2003
Posts: 3
Location: Singapore
|
Posted:
Sun Jun 22, 2003 6:34 am (21 years, 6 months ago) |
|
i have extract my information from the database and arrange in the order of have stock, out of stock, preorder... however, when i try to add in RAND after order by, it messed up my arrangement and did not randomize... can someone help me on it... i will really appreciated it....
my code...(i have delete the word RAND so as not to confuse you all...)
thanx...
<%
sql = " Select products.*, products.ccategory, categories.catdescription " &_
" FROM categories INNER JOIN products ON categories.categoryID=products.ccategory " &_
" WHERE products.ccategory= " & cInt(catID(j))
sql = sql & " ORDER BY products.stockquantity DESC, products.preorder ASC "
set rs = server.CreateObject("ADODB.Recordset")
rs.Open sql, dbc, adOpenForwardOnly,adLockReadOnly,adCmdText
%> |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 22, 2003 8:36 am (21 years, 6 months ago) |
|
Hello,
It is possible that the RAND() function only works if you don't specify the fields you wish to select (products.* instead of products.ccategory), as this is the case with MySQL. |
________________________________
|
|
|
|
therapy
Junior WebHelper
Joined: 22 Jun 2003
Posts: 3
Location: Singapore
|
Posted:
Sun Jun 22, 2003 1:37 pm (21 years, 6 months ago) |
|
i dun really understand... can you show me how... please... thanx... i'm not very good on such thing...thanx |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 22, 2003 1:40 pm (21 years, 6 months ago) |
|
I'm probably wasting your time, since I don't have a clue about the language and database you're using, but try replacing Code: | sql = " Select products.*, products.ccategory, categories.catdescription " &_
" FROM categories INNER JOIN products ON categories.categoryID=products.ccategory " &_
" WHERE products.ccategory= " & cInt(catID(j)) | with Code: | sql = " Select products.*, categories.* " &_
" FROM categories INNER JOIN products ON categories.categoryID=products.ccategory " &_
" WHERE products.ccategory= " & cInt(catID(j)) |
and then trying the RAND function.
You never know, it just might work |
________________________________
|
|
|
|
therapy
Junior WebHelper
Joined: 22 Jun 2003
Posts: 3
Location: Singapore
|
Posted:
Sun Jun 22, 2003 2:16 pm (21 years, 6 months ago) |
|
sorry,... it is still not working... stress... |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.156301 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |