asp classic - I need to query against a column name using SQL in ASP -


so need make multiple queries based on string name within column. i'm not sure if i'm doing correctly. in divisionnew table there column name jmsday values of "sunday" , "monday"

<%  set rssun = server.createobject("adodb.recordset") sql = "select * divisionnew jms_updatedatetime >= dateadd(day,-7, getdate()) , jmsday = 'sunday'" rssun.open sql, db  capacity = rssun ("suncapacity")  %>  <%  set rsmon = server.createobject("adodb.recordset") sql = "select jmsday divisionnew jms_updatedatetime >= dateadd(day,-7, getdate()) , jmsday = 'monday'" rsmon.open sql, db  capacity = rsmon ("moncapacity") %> 

the query results placed within table.

<table>    <tr>             <th>sun</th>             <th>mon</th>         </tr>             <tr>      <td class="sunday">  <input type="text"  name="sun-capacity" id="sun-capacity"   value="<%=suncapacity %>" />     </td>  <td class="monday"> <input type="text"  name="mon-capacity" id="mon-capacity"  value="<% =moncapacity %>"  /> </td>           </tr> </table> 

i'm not sure if queries correct.

i'm pretty sure queries not correct. however, don't know correct queries be. here issues:

  • the sunday query return bunch of rows , bunch of columns. looks you're looking 1 value stick in html. it's not clear value want. want sum(value) in select clause: select sum(capacity) divisionnew jms_updatedatetime >= dateadd(day,-7, getdate()) , jmsday = 'sunday'
  • the monday query off. you're returning jmsday jmsday = 'monday'. you'll bunch of rows full of 'monday'. want return different column.
  • not related question: you're using same id , name twice in html. won't able tell input which.

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -