Conditional Query On ASPNET Page

Sep 12, 2007

Dear Friends,


I am working on search customer information page.

I have 5 search options,

Name,
Email,
Order Number,
Product Name,
Order Date


I am using check boxes, I need to allow admin to enter above information and click on search,

How will I make my query and sends to DB server to pull up records which satisfies where clause:

For example,

Select * from orders where Email = #Email#

This is simple, but I can not hardcode all queries, I don€™t know in advance what different search option ADMIN may choose.

Any suggestion for logic or query make up,

Thanks,

Fahim.

View 1 Replies


ADVERTISEMENT

Conditional Page Throw

Mar 30, 2007

I'm looking for help on how to throw a page so that when printing duplex (both sides) a group will start on an odd page number eg 1, 3, 7, 9 etc. My large report needs to be split up into departments. I don't want a department starting on the reverse side of a sheet of paper.

Your help would be appreciated.

View 1 Replies View Related

Conditional Page Breaks In SSRS

Jun 2, 2007





Hi,



I am having trouble setting conditional page breaks to my reports.



i.e... I am having a report where I need to allow user the option to set page break between a group or not.



Based upon the option selected by the user, I need to add page break to the report. I tried with all possibilities inside Sort and Group dialog box, but could not figure out how to toggle the option at runtime.



Does anyone know how to implement page breaks on runtime? Help me plzzzz!! I really need this to be done€¦Thanx in advance for any help..



- Rayz

View 28 Replies View Related

Matrix Page Breaks Within A List / Visibility Is Conditional

Aug 13, 2007

Think I have found a bug.

I have a report that has a Parameter called "LevelOfDetail" This has 2 possible values "Summary, Detail, or Combined".

The report has a Summary Section and a subreport that holds the details.
WIthin the summary section is a Matrix (a list of all properties and some values)

If they choose to see the details, the matrix in the details section will show a break out of all this information summarized in the summary section.

The Details Matrix is set to have a page break at the beginning and end of the top level group.

I have a list control on the summary page that contains the details subreport and passes the appropriate parameter.

Everything works the way I want until I try to set visibility on sub report.

Once I set the conditional visibility of the report objects (based on the Level of Detail parameter) the page breaks are not recognized.

This is important as the user will never print the report, but will be downloading to Excel.

If the page breaks work correctly, each page is assigned a different worksheet in their downloaded workbook.

Any help, please let me know.

View 1 Replies View Related

Problem With Page Break In A Data Region Who's Visibility Is Conditional

Jan 9, 2008

I have a report which produces invoices.
These invoices are more complex than your average ones.

The invoice is for one customer but many orders. Within the invoice, orders are grouped together by their delivery address which can be different for each order within the invoice. I throw a page for each seperate delivery account and sub-total by delivery account too. All this works fine and page breaks are all OK. However I also need a summary page at the end of the invoice showing 1 line per delivery account andf the sub-total for it, then I show a grand total.

To achieve this, I used a list control, grouping on Invoice number. within it I placed 2 tables. 1 is the main Invoice table, the 2nd is the summary table. I have a page break on a group in table 1 that controls the split on delivery account. I have a page breaks on table 2. Again this all works fine and paging is perfect.

Here's the crunch though! If the invoice only contains one delivery account, I need to suppress the summary table. This I can do BUT I still get the page throw for it, effectively giving blank pages. The page break is triggered regardless of whether the containing control is visible or not.

I'm pretty accomplished with RS and I've tried all sorts of tricks and hacks to get round it but it seems a page break is added regardless of whether the control triggering it is visible or not!

I've tried rectangles both with the table in it and outside. And with the page break on the rectangle and when that didn't work , on the table inside it.

Any one else have any ideas on this.

Cheers
Chris

View 6 Replies View Related

Accepted Practice To Query The Built-in Aspnet Membership Tables ?

Jul 17, 2007

I'm a relative newbie to ASP.NET development (web development in general) so please forgive the ignorance. ;-)
Ok, I'm using VWD to design and test my application and I'm using the standard membership provider system.  I've read in various places not to muck around with the aspnet_* tables as it can cause havoc hehe.  Therefore, I've created my own Member table to accommodate more fields that the aspnet_Users table does not have (since I don't want to mess around with that table) such as address, city, town, zip, birth date, etc.  Obviously, I have a field in Member that corresponds to the userId primary key in aspnet_Users.  Now, there are times when I need to display the username of a person's profile on a page.
SELECT aspnet_Users.UserName<br>FROM aspnet_Users, Member<br>WHERE querystringid=Member.memberId AND Member.userId = aspnet_Users.UserId
Now, this seems fine and dandy when there are few entries in the aspnet_Users table, but what if I tried that query when aspnet_Users grew to a hypothetical one million entries??  Does anyone know if those fields in aspnet_Users are properly indexed?  I can't seem to determine one way or another with VWD's database explorer.  I don't want to run the risk of a full table scan.  But if those fields aren't indexed, I don't know if I should modify that table in any way.
What to do?
TIA

View 4 Replies View Related

Conditional Query

Mar 7, 2007

Hi again. Another problem though...
Can I make a query in if else statement? For example
int querynum;
if(querynum==1)<execute query1>
else if(querynum==2)<execute query2>
else <execute query3>

There is no problem with passing parameters(getquerynum) from my front end application to sql function. I can manage to do it. hehe.

the query looks like this:

DECLARE @querynum number
SET @querynum = @getquerynum

what i want to do is,

if(querynum==1) Select * from hremployees
else if(querynum==2) Select * from hrapplicants
else Select * from pspersonaldata

is it possible by having multiple queries in conditional statement?
if so, how to do it in sql language?
Thanks
-Ron-

View 14 Replies View Related

Conditional Query

Mar 15, 2007

I have a table having CusId, CusName, LocId and TvId among other fields.
I have 3 dropdown list which are are populated with cusid, locid and tovid.

I have added "Please Select" in all the 3 ddl with value -1.
Now i have written a sql statement as :

declare @CusId int
declare @LocId int
declare @TvId int

select CusId, CusName, LocId and TvId
From CustDetails
where CusId = @CusId
and LocId = @LocId
and TvId = @TvId


All i want is if any of the three variables has a value -1 then query should be modified. say @CusId has a value of -1 selected in dropdown list then query should become

select CusId, CusName, LocId and TvId
From CustDetails
where CusId IS NOT NULL
and LocId = @LocId
and TvId = @TvId


Please help me on this as i am totally new to sql.

Regards
Tingu

View 5 Replies View Related

Conditional Query

Apr 27, 2006

Hi,I'm trying to construct a query (in a stored procedure) which will have a number ofselection criteria based on input parameters. There are a number of these parameterswhose selection conditions they represent which all have to be true for a row to bereturned in the resultset.The basic query is:SELECT Store, StoreNumberFROM StoresWHERE ...I'm trying to come up with the WHERE clause.For example, I want to define a parameter named @ExcludeSpecialties which if it hasthe value 1, means to return all stores but exclude stores whose StoreNumber is inthe list (800, 802, 804). If the parameter has the value 0, then it means "don'tcare" and all StoreNumbers should be returned.One could certainly argue that there probably should have been an column in theStores row to indicate the store is a specialty store, rather than using a hard-wiredlist of numbers. But the current data schema cannot be easily changed. Besides, thelist never changes.Indeed, there is a Franchise bit column in the row which is selected by anotherparameter called @ExcludeFranchise whose WHERE predicate could be written as:WHERE Franchise = CASE WHEN @ExcludeFranchise = 1 THEN 0 ELSE Franchise ENDand if all the parameters were like this, I wouldn't be posting. Sadly, for theSpecialties test I'm stuck with a NOT IN list.This is easy enough to do in an IF/ELSE block, but there are several such similarparameters whose values may be specified in any combination. This, I think, makesIF/ELSE impractical as the number of IF/ELSE statements to handle all possiblecombinations would grow very quickly.I'm hoping there is a simple solution to this NOT IN list, and it's just that I can'tsee it.Can anyone help?Thanks,-- Jeff

View 2 Replies View Related

Conditional Query Results

Dec 19, 2006

Hello everybody,After several attempts of writing the query, I had to post myrequirement in the forum.Here is what I have, what I need and what I did.Table ACol1 Col21 Nm12 Nm23 Nm3Table BCol1 Col210 10020 200Table CCol1 (A.Col1) Col2 (B.Col1)1 102 10Table DCol1 (A.Col1) Col21 Value12 Value2I need results based on below criteria,1.Criteria - B.Col2 = 100ResultsetA.Col1 D.Col11 Value12 Value22.Criteria - B.Col2 =""A.Col1 D.Col11 Value12 Value23 NULL3.Criteria - B.Col2 =200Empty resultsetHere is the query I tried, but looks its not working. Probably there isa better way to do this.DDL and DML statements:create table #tab1 (a1 int, a2 nvarchar(20))create table #tab2 (b1 int, b2 int)create table #tab3 (c1 int, c2 int)create table #tab4 (d1 int, d2 nvarchar(20))insert into #tab1 values (1, 'nm1')insert into #tab1 values (2, 'nm2')insert into #tab1 values (3, 'nm3')insert into #tab2 values (10, 100)insert into #tab2 values (20, 200)insert into #tab3 values (1, 10)insert into #tab3 values (2, 10)insert into #tab4 values (1, 'value1')insert into #tab4 values (2, 'value2')selecta.a1, d.d2from #tab1 aleft join #tab3 bon a.a1 = b.c1left join #tab2 con b.c2 = c.b1left join #tab4 don a.a1 = d.d1wherec.b2 = [100 or 200 or ''] or exists (select 1 from #tab4 dwhere a.a1 = d.d1and c.b2 = [100 or 200 or ''] )The above query works well to give results for Criteria 1 and Criteria3, but doesn't return for '' (criteria 2). I couldn't manage crackingthe solution. I shall try once again, but meanwhile if anyone couldhelp me in this, that would be great.Thanks.

View 3 Replies View Related

Conditional Split Query

Sep 23, 2007


Hi,
I have the following table in MsAccess

EmployeesA
empId integer,
empName varchar(60),
empAge integer,
empStatus char(1) - can be N,D or S - New, Deleted or Shifted


and the following in Sql2005

EmployeesB
Id smallint,
Name varchar(60),
Age int,
Status char(1) - Bydefault 'N'

I have written a Foreach File package that populates the sql server tables (EmployeesB) from Access(EmployeesA). However i want to check for a condition now.

If empStatus = N in EmployeesA, then insert a new record in EmployeesB
If empStatus = D in EmployeesA, then search for that field in the EmployeesB by passing empname and age and if found, mark the Status field in EmployeesB as 'D'
If empStatus = S in EmployeesA, then search for that field in the EmployeesB by passing empname and age and if found, mark the Status as 'S' in EmployeesB and insert a new row.

How do I do it for each table each row in EmployeesA using a foreach file loop?

Thanks,
ron

View 8 Replies View Related

Can I Roll Back Certain Query(insert/update) Execution In One Page If Query (insert/update) In Other Page Execution Fails In Asp.net

Mar 1, 2007

Can I roll back certain query(insert/update) execution in one page if  query (insert/update) in other page  execution fails in asp.net.( I am using sqlserver 2000 as back end)
 scenario
In a webpage1, I have insert query  into master table and Page2 I have insert query to store data in sub table.
 I need to rollback the insert command execution for sub table ,if insert command to master table in web page1 is failed. (Query in webpage2 executes first, then only the query in webpage1) Can I use System. Transaction to solve this? Thanks in advance

View 2 Replies View Related

Help - Conditional Checks Within A SQL Query - Other Ways Of Doing It?

Jun 13, 2007

I'm trying to simplify a SQL Stored Procedure.The query accepts an int, @ItemTypeID intI have the Query:SELECT ... FROM ItemList WHERE ItemTypeID = @ItemTypeIDor, if @ItemTypeID is 0,SELECT ... FROM ItemList Is there a way to do this query without doing:IF @ItemTypeID = 0BEGIN   ...SELECT QUERY...ENDELSEBEGIN   ...SELECT QUERY...END? 

View 5 Replies View Related

Should Be Easy - Help Formatting A Conditional Query.

Aug 28, 2006

SQL Server 2000. Here's what I have so far. The section of the query I need help with is highlighted in blue.
 
CREATE PROCEDURE dbo.GetByVersion
(
 @targetVersion varchar(30),
 @product varchar(50)
)
AS
 SET NOCOUNT ON;
SELECT *  FROM  MyTable
WHERE (product = @product)
AND
  CASE 
    WHEN @targetVersion='' THEN (targetVersion='')
    ELSE (targetVersion LIKE @targetVersion + '%')
  END
GO
 
I get a syntax error in the Stored Procedure editor on an equal sign in this line:
    WHEN @targetVersion='' THEN (targetVersion='')

What I want is this (in psuedocode):
  if @targerVersion is blank
    search for records where the targetVersion column = blank
  else
    search for records where the targetVersion column starts with @targetVersion
 
Can anyone offer any suggestions as to how I might modify my query to do what I want? Any help is very much welcome - Thanks in advance! :-)

View 5 Replies View Related

Stored Procedure Query With A Conditional Part?

Apr 23, 2005

Hi,

I'm converting some direct SQL queries into stored procedures. The
original queries have conditional parts appended depending on certain
parameters like this:

Sql = "First part"
If certain condition then
   Sql &= "Second part"
Endif

How could I do this in a stored procedure? So far I have made them like this:

IF @condition > 0
Fist part Second part
ELSE
First part

You can see that I have to maintain 'First part' in two locations. What is a better way of dealing with this?

Thanks!

  Noc

View 3 Replies View Related

Conditional Return Of A Value From A Set Of Records As A Field Value In A Query

Dec 20, 2007

Hi,

I need to implement some thing like this.

I have a query like

SELECT table1.col1
,€™n/a€™ _response
FROM table1
INNER JOIN table2

This is the query that get the report data for my report. Now I need to replace the second column with an actual response like €˜accepted€™ and €˜rejected€™. And these values should be a result of evaluation of this form

Statusarray[] = ResponseStoredProcedure(table1.col1)

If(Statusarray.count < 1)
Set _response = €˜accepted€™
Else
Get Statusarray[1]
Compare this to Statusarray[0]
Set _response = some result based on comparision.

The _response returned in the query should return the actual response based on this evaluation where ResponseStoredProcedure is sent the current row value for table1.col1.

How can this be done in sql(using SQL Server 2005)

PLZZZ HELP!!!!!!!!!

Thanks,
Hari

View 2 Replies View Related

Query Works In 'test Query' But Refuses To Show Up In The Datagrid On A Web Page - Urgent!

Mar 28, 2007

Hey, i've written a query to search a database dependant on variables chosen by user etc etc. Opened up a new sqldatasource, entered the query shown below and went on to the test query page. Entered some test variables, everything works as it should do. Try to get it to show in a datagrid on a webpage - nothing. No data shows.
 SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches
FROM dbo.MAKES INNER JOIN
dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN
dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN
dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN
dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID
WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or
(ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) )
GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID
HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2
ORDER BY count(*) DESC

 Here is the page source
 
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>"
SelectCommand="&#9;SELECT dbo.DERIVATIVES.DERIVATIVE_ID, count(*) AS Matches&#13;&#10;&#9;FROM dbo.MAKES INNER JOIN&#13;&#10;&#9;&#9;&#9;&#9; dbo.MODELS ON dbo.MAKES.MAKE_ID = dbo.MODELS.MAKE_ID INNER JOIN&#13;&#10;&#9;&#9;&#9;&#9; dbo.DERIVATIVES ON dbo.MODELS.MODEL_ID = dbo.DERIVATIVES.MODEL_ID INNER JOIN&#13;&#10;&#9;&#9;&#9;&#9; dbo.[VALUES] ON dbo.DERIVATIVES.DERIVATIVE_ID = dbo.[VALUES].DERIVATIVE_ID INNER JOIN&#13;&#10;&#9;&#9;&#9;&#9; dbo.ATTRIBUTES ON dbo.[VALUES].ATTRIBUTE_ID = dbo.ATTRIBUTES.ATTRIBUTE_ID&#13;&#10;&#9;WHERE ((ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID1 and (@VAL1 is null or VALUE = @VAL1)) or&#13;&#10;&#9;&#9; (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID2 and (@VAL2 is null or VALUE = @VAL2)) or&#13;&#10;&#9;&#9; (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID3 and (@VAL3 is null or VALUE = @VAL3)) or&#13;&#10;&#9;&#9; (ATTRIBUTES.ATTRIBUTE_ID = @ATT_ID4 and (@VAL4 is null or VALUE = @VAL4)) )&#13;&#10;&#9;GROUP BY dbo.DERIVATIVES.DERIVATIVE_ID&#13;&#10;&#9;HAVING count(*) >= CASE WHEN @VAL1 IS NOT NULL THEN 1 ELSE 0 END +&#13;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; CASE WHEN @VAL2 IS NOT NULL THEN 1 ELSE 0 END +&#13;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; CASE WHEN @VAL3 IS NOT NULL THEN 1 ELSE 0 END +&#13;&#10;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; CASE WHEN @VAL4 IS NOT NULL THEN 1 ELSE 0 END -2&#13;&#10;&#9;ORDER BY count(*) DESC&#13;&#10;">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="ATT_ID1" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="TextBox1" Name="VAL1" PropertyName="Text" />
<asp:Parameter Name="ATT_ID2" />
<asp:Parameter Name="VAL2" />
<asp:Parameter Name="ATT_ID3" />
<asp:Parameter Name="VAL3" />
<asp:Parameter Name="ATT_ID4" />
<asp:Parameter Name="VAL4" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnectionString1 %>"
SelectCommand="SELECT * FROM [ATTRIBUTES]"></asp:SqlDataSource>
<br />
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
DataTextField="ATTRIBUTE_NAME" DataValueField="ATTRIBUTE_ID">
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox><br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="DERIVATIVE_ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="DERIVATIVE_ID" HeaderText="DERIVATIVE_ID" InsertVisible="False"
ReadOnly="True" SortExpression="DERIVATIVE_ID" />
<asp:BoundField DataField="Matches" HeaderText="Matches" ReadOnly="True" SortExpression="Matches" />
</Columns>
</asp:GridView>
</asp:Content>
 AFAIK I have configured the source to pick up the dropdownlist value and the textbox value (the text box is autopostback).
 Am i not submitting the data correctly? (It worked with a simple query...just not with this one). I have tried a stored procedure which works when testing just not when its live on a webpage.
 Please help!
 
(Visual Web Devleoper 2005 Express and SQL Server Management Studio Express)
 

View 4 Replies View Related

Reporting Services :: All Record Are Displaying On One Page - How To Display Page By Page

Nov 11, 2015

I have created one reports but all the records are displaying on one page.find a solution to display the records page by page. I created the same report without group so the records are displaying in page by page.

View 3 Replies View Related

Too Busy To Implement A Trigger? Nor A Conditional Update Query?

Dec 20, 2004

Hi:

In a very busy SQL2000 enterprise edition server with 8GB memory and 6 cpus sp3, I could not install a update trigger, unless all the appl connections are dropped. For this 24 HR running svr, could do it.

then I try to run a query as follows:

if exists (select rfABC.* A
from rfABC inner join remoteSvr.XYZDB.dbo.vwIP L
on A.Address = L.address and
A.metro <> L.metro
begin
print ' ---- Yes metroID <> LAMetro, start job exec.... -----'

insert into tempCatchMetroIDGPRS
select rfABC.*, metro, getdate()
from rfABC inner join remoteSvr.XYZDB.dbo.vwIP L on rfABC.Address = L.address and rfABC.metro <> L.metro

update rfABC A
set A.metro = L.metro
from rfABC A inner join remoteSvr.XYZDB.dbo.vwIP L on A.Address = L.address and A.metro <> L.metro
end
else
begin
print ' ---- no metroID <> LAMetro, skip job exec.... -----'
end

------------------------------
this query hang there could not execute. When I took off the if ... else condition, it run with like 0 second. Wondered if a 'busy' (which updates the IP address continueously) could cause above issues...

thanks
David

View 4 Replies View Related

Conditional Subscription / Conditional Execution Of Report

Mar 7, 2008



Hello everyone,

Is there a way in order to execute a subscribed report based on a certain criteria?

For example, let's say send a report to users when data exist on the report else if no data is returned by the query
executed by the report then it will not send the report to users.

My current situation here is that users tend to say that this should not happen, since no pertinent information is contained in the report, why would they receive email with blank data in it.


Any help or suggestions will be much appreciated.

Thanks,
Larry

View 6 Replies View Related

How To Run An Asp Page From Sql Query

May 28, 2008

Hi,
      I want to run an asp file from a query written in sql 2005.
     How can I achieve this in sql?
      Please let me know its very urgent.
 

View 1 Replies View Related

SQL Query From Web Page?

Sep 9, 2004

Hi, I have an SQl database that i want to build a simple search query for that would be accessible from an HTML page, what would be the best way of going about this? and what would be the best language to use?

Thanks in advance

View 1 Replies View Related

Page 2 - HELP With SQL Query - (complicated)

Oct 10, 2006

You can display both by referring to their position in the recordset or by aliasing them in the query and referring to the alias in your code.
Note that in order to put Products.Quantity or ProductDetails.Quantity in just one column you'll have to add some logic in the query, using a coalesce, like:

sql Code:






Original
- sql Code




SELECT
Products.ProductID, Products.ProductName, Products.ProductPict,
COALESCE(Products.Quantity, ProductDetails.Quantity, 0) Quantity,
ProductDetails.ProductDetailID, ProductDetails.P_Size, ProductDetails.P_Color
FROM
Products
LEFT OUTER JOIN
ProductDetails
ON Products.ProductID = ProductDetails.ProductID
WHERE
Products.Quantity <= "& +rsResults__var1 & "
OR
ProductDetails.Quantity <= "& +rsResults__var1 & "
Order by Products.ProductID asc;






SELECT Products.ProductID, Products.ProductName, Products.ProductPict, COALESCE(Products.Quantity, ProductDetails.Quantity, 0) Quantity,ProductDetails.ProductDetailID, ProductDetails.P_Size, ProductDetails.P_ColorFROM Products LEFT OUTER JOIN ProductDetails ON Products.ProductID = ProductDetails.ProductID WHERE Products.Quantity <= "& +rsResults__var1 & " OR  ProductDetails.Quantity <= "& +rsResults__var1 & " ORDER BY Products.ProductID ASC;

Untested, beware of syntax errors!
In this case you'll have just one Quantity colum and you won't have to change anything in your asp code.

View 1 Replies View Related

Query For Page Views

Apr 28, 2008

I have a table which records the amount of times a user views a webpage

tblpageview

id
pagename
view_date
userid

I would like to have a query that returns the unique pagename and the amount of times that page has been viewed. I've had a go with count etc. but cant seem to get it. Anyone can help?

View 3 Replies View Related

Page 2 - Query Problem

Sep 6, 2007

Hmm... the query should return the number of athletes with scores >= to your own.

So if you have the highest score in the world, for example, then the only score >= to your own is... yours. The count of that is 1, giving you rank 1.

If the order seems backwards to you just reverse the <= operator in the WHERE clause. Either way, as a responsible developer, never never never put a SQL query you don't understand into production.

Fixed the ServerID thing, too. It was there because I don't have a table that matches yours and wrote the query against one with a compatible structure, but different names.

View 4 Replies View Related

I Need To Pass Data Entered /created On The First Page To The Next Page And Populate The Next Page With Some Data From The Fir

Nov 28, 2006

Hello I have a project that uses a large number of MS Data access pages created in Access 2003 and runs on MS SQL2005.

When I am on lets say my client, (first page in a series) data access page and I have completed the fields in the (DAP), I am directing my users to the next step of the registration process by means of a hyperlink to another Data access page in the same web but in a linked or sometimes different table.


I need to pass data entered /created on the first page to the next page and populate the next page with some data from the first page / table. (like staying on the client name and ID when i go to the next page)


I also need the first data access page to open and display a blank or new record. Not an existing record. I will also be looking to creata a drop down box as a record selector.


Any pointers in the right direction would be appreciated.
I am some what new to data access pages so a walk through would be nice but anything you got is welcome. Thanks Peter€¦

View 2 Replies View Related

Urgent Converting A Query To A .asp Page

Aug 24, 2004

I am extremely new with .asp. We have the .net framework 1.1 installed on our server and the following query works in Crystal Reports (older version). We would like to have this converted to a .asp page with two inputs. One for the date range and one for the state. Can someone please tell me how to go about this. I do have downloaded as test. Visual Studio 2003.net and Web Matrix. I really am looking for (if there is any) a way to pretty quickly convert query to web pages so users can use them without a huge expense. IF someone already has something like this done. That would be great. The following query is for Visual Enterprise (Manufacturing software). Thanks


SELECT
SHIPPER."CUST_ORDER_ID", SHIPPER."SHIPPED_DATE", SHIPPER."INVOICE_ID",
SHIPPER_LINE."USER_SHIPPED_QTY", SHIPPER_LINE."SHIPPED_QTY", SHIPPER_LINE."UNIT_PRICE",
RECEIVABLE_CURR."CURRENCY_ID", RECEIVABLE_CURR."SELL_RATE",
CUST_ORDER_LINE."PART_ID", CUST_ORDER_LINE."ORDER_QTY", CUST_ORDER_LINE."USER_ORDER_QTY",
INVENTORY_TRANS."TYPE", INVENTORY_TRANS."ACT_MATERIAL_COST", INVENTORY_TRANS."ACT_LABOR_COST", INVENTORY_TRANS."ACT_BURDEN_COST", INVENTORY_TRANS."ACT_SERVICE_COST",
CUSTOMER_ORDER."CUSTOMER_ID", CUSTOMER_ORDER."SHIP_TO_ADDR_NO", CUSTOMER_ORDER."CURRENCY_ID",
PART."DESCRIPTION", PART."STOCK_UM",
CUSTOMER."STATE",
CUST_ADDRESS."ADDR_NO", CUST_ADDRESS."NAME", CUST_ADDRESS."STATE"
FROM
{ oj ((((((("VMFG"."dbo"."SHIPPER" SHIPPER INNER JOIN "VMFG"."dbo"."RECEIVABLE_CURR" RECEIVABLE_CURR ON SHIPPER."INVOICE_ID" = RECEIVABLE_CURR."INVOICE_ID") INNER JOIN "VMFG"."dbo"."SHIPPER_LINE" SHIPPER_LINE ON SHIPPER."PACKLIST_ID" = SHIPPER_LINE."PACKLIST_ID" AND SHIPPER."CUST_ORDER_ID" = SHIPPER_LINE."CUST_ORDER_ID") INNER JOIN "VMFG"."dbo"."INVENTORY_TRANS" INVENTORY_TRANS ON SHIPPER_LINE."TRANSACTION_ID" = INVENTORY_TRANS."TRANSACTION_ID") INNER JOIN "VMFG"."dbo"."CUSTOMER_ORDER" CUSTOMER_ORDER ON SHIPPER_LINE."CUST_ORDER_ID" = CUSTOMER_ORDER."ID") INNER JOIN "VMFG"."dbo"."CUST_ORDER_LINE" CUST_ORDER_LINE ON SHIPPER_LINE."CUST_ORDER_ID" = CUST_ORDER_LINE."CUST_ORDER_ID" AND SHIPPER_LINE."CUST_ORDER_LINE_NO" = CUST_ORDER_LINE."LINE_NO") INNER JOIN "VMFG"."dbo"."CUSTOMER" CUSTOMER ON CUSTOMER_ORDER."CUSTOMER_ID" = CUSTOMER."ID") INNER JOIN "VMFG"."dbo"."PART" PART ON CUST_ORDER_LINE."PART_ID" = PART."ID") LEFT OUTER JOIN "VMFG"."dbo"."CUST_ADDRESS" CUST_ADDRESS ON CUSTOMER_ORDER."CUSTOMER_ID" = CUST_ADDRESS."CUSTOMER_ID" AND CUSTOMER_ORDER."SHIP_TO_ADDR_NO" = CUST_ADDRESS."ADDR_NO"}
WHERE
SHIPPER."SHIPPED_DATE" >= {ts '2002-08-01 00:00:00.00'} AND
SHIPPER."SHIPPED_DATE" < {ts '2004-08-25 00:00:00.00'}
ORDER BY
SHIPPER."SHIPPED_DATE" ASC

View 3 Replies View Related

Page 2 - Monsterous SQL Query... Suggestions?

Jan 18, 2008

Here you go:

The telephone numbers are just strings of the same integer,

1's: Calls made every day
2's: Calls made every day
3's: Two, non consecutive days without calls
4's: No calls made from 2nd till 6th
5's: Only one day with calls
6's: No calls made from 2nd to 6th, but many made on the 1st
7's: No calls made from 2nd till 13th

If you'd like a bigger sample set then I will create one.


Code:


CREATE TABLE tblCallSummary(
[CallID] [int] IDENTITY(1,1) NOT NULL,
[TelephoneNumber] [varchar](11) NOT NULL,
[StartTime] [smalldatetime] NOT NULL,
[Duration] [int] NOT NULL,
CONSTRAINT [PK_tblCallSummary] PRIMARY KEY CLUSTERED
(
[CallID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-01'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-02'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-03'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-04'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-05'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-06'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-07'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-08'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-09'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-10'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-11'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-12'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-13'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('11111111111',CONVERT(smalldatetime,'2007-12-31'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-01'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-02'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-03'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-04'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-05'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-06'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-07'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-08'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-09'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-10'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-11'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-12'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-13'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('22222222222',CONVERT(smalldatetime,'2007-12-31'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-02'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-03'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-05'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-07'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-09'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-11'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-12'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-13'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('33333333333',CONVERT(smalldatetime,'2007-12-31'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-01'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-07'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-08'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-09'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-10'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-11'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-12'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-13'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('44444444444',CONVERT(smalldatetime,'2007-12-31'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('55555555555',CONVERT(smalldatetime,'2007-12-10'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-01'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-07'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-08'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-09'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-10'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-11'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-12'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-13'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('66666666666',CONVERT(smalldatetime,'2007-12-31'),1)

INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-01'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-14'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-15'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-16'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-17'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-18'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-19'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-20'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-21'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-22'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-23'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-24'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-25'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-26'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-27'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-28'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-29'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-30'),1)
INSERT INTO tblCallSummary(TelephoneNumber,StartTime,Duration) VALUES('77777777777',CONVERT(smalldatetime,'2007-12-31'),1)



Our requirements have just changed and we only need customers which were active in the last five days, a very easy query. So please don't spend too much of your time on this now, however, I am still keen to find an elegant way of solving this problem, if one exists so any input from you would be appreciated.

Thanks for you help

Dave

View 5 Replies View Related

Page 2 - Some Assistance With Query Needed -_-

Oct 26, 2004

Code:

select *
from linkboxes l
left outer
join subjects s
on l.sub_link_id
= s.sub_id
left outer
join external_links e
on l.ext_link_id
= e.ext_id
where l.sub_id = subid

View 4 Replies View Related

Front Page 2002 And SQL Query

Jul 23, 2005

I am using a very basic query in Front Page 2002 against a SQL table inSQL 2000SELECT * FROM tablename WHERE (f_docnumber = ::f_docnumber::)and f_docnumber is a search form field.When I run I getDescription: The precision is invalid.Number: -2147467259 (0x80004005)The field is defined in the table as numberic 9(10,0)Any ideas?

View 1 Replies View Related

How To Program A Button To Query Database On Another Page ?

Jan 16, 2008

hi.
When i click on the button, it will go to another page called fileB.aspx, it will query database based on textbox parameter from fileA.aspx and display gridview on fileB.aspx
It is based on sqldatasource. abit noob on programming visual basic.Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Code go here.End Sub
 
 

View 3 Replies View Related

ID Who Didn't Visited A Summary Page Per Day (was Help With Query)

Mar 9, 2006

I have 1 table:
ID pagename datevisited
1default01/01/2006
1info01/01/2006
1default02/01/2006
1info02/01/2006
1summary02/01/2006
2default02/01/2006
2info02/01/2006
2summary02/01/2006

I need to run query for ID who didn't visited a summary page(per day)
How do I do this?

View 1 Replies View Related

How To Page SQL Query Result Returned From FOR XML Statement?

Apr 25, 2006

Gurus.I do not know if it is possible, but here is what I want to do.I want to allow user to page the SQL result, so he could decides toreturn from row 10 to row 20, or row 100 to 200, without returns thewhole resultset. Every time he sends another request, I do not mind tohit the database again, (I do not want to cache the result in themiddle tier server, scalability issue), and I know that I could achievethis with CURSOR, but unfortunately the FOR XML is not allowed in aCURSOR statement .(I know that I could achieve what I want to do by writing custom codein the middle tier, but I just want to see if there is a way to do thison the database side.)Any comments & suggestion is greatly appreciated.Thanks in advance.(I am using SQL2005)John

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved