SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 23rd, 2001, 04:37 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
how to order by field and subfield ?

<i><b>Originally posted by : goodlook (deloenzien@goodlook.be)</b></i><br /><br />Hi,<br /><br />how do i sort my database first on the field "dienst" and then on the field "dokter"<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />for example<br />dienst : dokter<br />a : dr.1<br />b : dr.2<br />a : dr.2<br />b : dr.1<br />b : dr.3<br /><br />sould be :<br />dienst : dokter<br />a : dr.1<br />a : dr.2<br />b : dr.1<br />b : dr.2<br />b : dr.3<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />best regards,<br />The Belgium

Reply With Quote
  #2  
Old May 23rd, 2001, 05:08 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Graham Masters (graham_masters@yahoo.com)</b></i><br />Your example is a little unclear in that the request object is referencing names that look like a table columns ("dokter" and "dienst")versus a field name such as "user_sort_field1", "user_sort_field2".<br /><br />If your sort columns are known a priori then you can simply write:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY dokter, dienst"%><br /><br />If the sort columns are derived a run time from a form then something like:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " &<br />Request.QueryString ("Sort_Field1") &<br />", " Request.QueryString ("Sort_Field2") %><br /><br />However, make sure the requests return non empty valid column names otherwise you'll have either syntax or invalid object errors.<br /><br />Graham<br /><br /><br />------------<br />goodlook at 5/23/2001 2:37:04 PM<br /><br /><br />Hi,<br /><br />how do i sort my database first on the field "dienst" and then on the field "dokter"<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />for example<br />dienst : dokter<br />a : dr.1<br />b : dr.2<br />a : dr.2<br />b : dr.1<br />b : dr.3<br /><br />sould be :<br />dienst : dokter<br />a : dr.1<br />a : dr.2<br />b : dr.1<br />b : dr.2<br />b : dr.3<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />best regards,<br />The Belgium

Reply With Quote
  #3  
Old May 23rd, 2001, 05:52 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : GoodLook (deloenzien@goodlook.be)</b></i><br />Hi, i'm a new ASp'er...<br /><br />bellow you find the asp page where i data sould br sorted first by "dienst" & then by "Name"<br /><br />hope you can help me ?<br /><br />------------------------------------------------<br /><HTML><br /><BODY><br /> <%mydienst = "HD"<br /> mywaar = "SF"<br /> fotocount = 0<br /> rijen = 3<br /> %><br /><br /><%<br /> Set MyConn = Server.CreateObject("ADODB.Connection")<br /> MyConn.Open "FILEDSN=c:dsnMyTable_dsn.dsn"<br />%><br /><br /><table border="0" width="100%" height="22" bordercolor="#008080" bgcolor="#FFCCCC"><br /><br /><br /> <%SQL_query = "SELECT * FROM Medical"<br /> Set RS = MyConn.Execute(SQL_query)<br /> WHILE NOT RS.EOF<br /> %><br /> <% if rs("dienst") = mydienst AND rs("waar") = mywaar then %><br /> <tr><br /> <td width="5%" height="13" align="left"><font face="Trebuchet MS" size="2"><%=RS("dienst")%></font></td><br /> <td width="12%" height="13" align="left"><font face="Trebuchet MS" size="2"><%=RS("NAME")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#FFFFE1"><font face="Trebuchet MS" size="2"><%=RS("MAANDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("DINSDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><%=RS("WOENSDAG")%></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("DONDERDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("VRIJDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><%=RS("ZATERDAG")%></td><br /> </tr><br /> <%else response.write "" END IF%><br /> <% <br /> RS.MoveNext<br /> WEND<br /> RS.Close<br />%> <br /> </table><br /><br /><br />best regards, the belgium with the bad english...<br /><br /><br />------------<br />Graham Masters at 5/23/2001 3:08:40 PM<br /><br />Your example is a little unclear in that the request object is referencing names that look like a table columns ("dokter" and "dienst")versus a field name such as "user_sort_field1", "user_sort_field2".<br /><br />If your sort columns are known a priori then you can simply write:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY dokter, dienst"%><br /><br />If the sort columns are derived a run time from a form then something like:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " &<br />Request.QueryString ("Sort_Field1") &<br />", " Request.QueryString ("Sort_Field2") %><br /><br />However, make sure the requests return non empty valid column names otherwise you'll have either syntax or invalid object errors.<br /><br />Graham<br /><br /><br />------------<br />goodlook at 5/23/2001 2:37:04 PM<br /><br /><br />Hi,<br /><br />how do i sort my database first on the field "dienst" and then on the field "dokter"<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />for example<br />dienst : dokter<br />a : dr.1<br />b : dr.2<br />a : dr.2<br />b : dr.1<br />b : dr.3<br /><br />sould be :<br />dienst : dokter<br />a : dr.1<br />a : dr.2<br />b : dr.1<br />b : dr.2<br />b : dr.3<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />best regards,<br />The Belgium

Reply With Quote
  #4  
Old May 26th, 2001, 04:21 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : </b></i><br />after looking around the following is the only working one :<br /><br />Thanks for helping out<br /><br /><%<br /> SQL_query = "SELECT * FROM Medical WHERE waar='"&mywaar&"' AND dienst='"&mydienst&"' AND type='"&mytype&"' ORDER BY Medical.Dienst, Medical.Name"<br /> Set RS = MyConn.Execute(SQL_query)<br /> WHILE NOT RS.EOF<br /> %><br /><br /><br /><br />------------<br />GoodLook at 5/23/2001 3:52:53 PM<br /><br />Hi, i'm a new ASp'er...<br /><br />bellow you find the asp page where i data sould br sorted first by "dienst" & then by "Name"<br /><br />hope you can help me ?<br /><br />------------------------------------------------<br /><HTML><br /><BODY><br /> <%mydienst = "HD"<br /> mywaar = "SF"<br /> fotocount = 0<br /> rijen = 3<br /> %><br /><br /><%<br /> Set MyConn = Server.CreateObject("ADODB.Connection")<br /> MyConn.Open "FILEDSN=c:dsnMyTable_dsn.dsn"<br />%><br /><br /><table border="0" width="100%" height="22" bordercolor="#008080" bgcolor="#FFCCCC"><br /><br /><br /> <%SQL_query = "SELECT * FROM Medical"<br /> Set RS = MyConn.Execute(SQL_query)<br /> WHILE NOT RS.EOF<br /> %><br /> <% if rs("dienst") = mydienst AND rs("waar") = mywaar then %><br /> <tr><br /> <td width="5%" height="13" align="left"><font face="Trebuchet MS" size="2"><%=RS("dienst")%></font></td><br /> <td width="12%" height="13" align="left"><font face="Trebuchet MS" size="2"><%=RS("NAME")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#FFFFE1"><font face="Trebuchet MS" size="2"><%=RS("MAANDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("DINSDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><%=RS("WOENSDAG")%></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("DONDERDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><font face="Trebuchet MS" size="2"><%=RS("VRIJDAG")%></font></td><br /> <td width="12%" height="13" align="center" bgcolor="#CFEFED"><%=RS("ZATERDAG")%></td><br /> </tr><br /> <%else response.write "" END IF%><br /> <% <br /> RS.MoveNext<br /> WEND<br /> RS.Close<br />%> <br /> </table><br /><br /><br />best regards, the belgium with the bad english...<br /><br /><br />------------<br />Graham Masters at 5/23/2001 3:08:40 PM<br /><br />Your example is a little unclear in that the request object is referencing names that look like a table columns ("dokter" and "dienst")versus a field name such as "user_sort_field1", "user_sort_field2".<br /><br />If your sort columns are known a priori then you can simply write:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY dokter, dienst"%><br /><br />If the sort columns are derived a run time from a form then something like:<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " &<br />Request.QueryString ("Sort_Field1") &<br />", " Request.QueryString ("Sort_Field2") %><br /><br />However, make sure the requests return non empty valid column names otherwise you'll have either syntax or invalid object errors.<br /><br />Graham<br /><br /><br />------------<br />goodlook at 5/23/2001 2:37:04 PM<br /><br /><br />Hi,<br /><br />how do i sort my database first on the field "dienst" and then on the field "dokter"<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />for example<br />dienst : dokter<br />a : dr.1<br />b : dr.2<br />a : dr.2<br />b : dr.1<br />b : dr.3<br /><br />sould be :<br />dienst : dokter<br />a : dr.1<br />a : dr.2<br />b : dr.1<br />b : dr.2<br />b : dr.3<br /><br /><%SQL = "SELECT * FROM Medical ORDER BY " & Request("dienst")%><br /><br />best regards,<br />The Belgium

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > how to order by field and subfield ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway