I am trying to do an update of a field based where I am getting the data from a join between 2 other tables. Can somebody tell me what is wrong with my syntax below?
update ContactExtensionBase
set New_DateEnquiryTaken = (
SELECT l.createdon
FROM ContactBase c
inner join LeadBase l...
...I add the final line :
'ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator'
select * from
(
SELECT top 5 COUNT(*) AS 'TotalEnquiries',
f.createdbyname as 'Name',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS...
I have a result set like this :
Other 34%
Dan 24%
Ken 17%
Claire 16%
Helen 9%
How do I other this so that the Other always shows as the last row, even if it isn't the lowest percentage?
I'm using SQL 2005..here is the full SQL including the union :
--select * from
--(
SELECT top 5 COUNT(*) AS 'TotalEnquiries',
createdbyname as 'Name',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead
where createdonutc
between DateAdd(Day...
...but the union prevents me from using order by. Here is my SQL before the union. How do I change this to work with order by?
SELECT top 5 COUNT(*) AS 'TotalEnquiries',
createdbyname as 'Name',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead...
This now gives me the top 5 but ordered by name rather than by count(*) :
SELECT top 5 COUNT(*) AS 'Total Enquiries',
createdbyname as 'Name',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead
where createdonutc
between DateAdd(Day...
I am using a union, but having problems getting a sum for the top 5 values. Here is my SQL, can anybody help?
SELECT top 5 COUNT(*) AS Expr1
FROM FilteredLead
where createdonutc
between DateAdd(Day, DateDiff(Day, 0, GetDate()-6), 0)
And DateAdd(day, DateDiff(Day, 0, GetDate() + 1)...
Sorry, my current SQL should read like this :
SELECT top 5 createdbyname as 'Name',
COUNT(*) AS 'Total Enquiries',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead
where createdonutc
between DateAdd(Day, DateDiff(Day, 0, GetDate()-6), 0)
And...
...Other 32 19
Here is my current SQL, how do I get the output I want?
--last week, all
SELECT createdbyname as 'Name',
COUNT(*) AS 'Total Enquiries',
round(100 * CAST(COUNT(*) as float) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead
where createdonutc...
...0 and 15.6 to 15, the total is no where near 100%. Can anybody tell me how to do this so it rounds up correctly?
SELECT createdbyname, COUNT(*) AS 'Total', 100 * COUNT(*) /
(SELECT COUNT(*) AS Expr1
FROM FilteredLead)...
I have some XML (see snippet below) and I have got so far with it, but I don't know how to get at the text within the <Value> tags :
<ResponseGroup refID="AnswerGroup184">
<ResponseText refID="Textbox25">
<Value>Mike</Value>
</ResponseText>
<ResponseText...
I am reading an image from a database and writing it to the screen. But now I also need to put a border around this image. Here is my code :
public void showSelectedImage(string strEncodedImage)
{
Response.Clear();
Response.ContentType = "image/jpeg"...
I am creating a number of System.Drawing.Image objects in my code, and I want to be able to add them to an object such as a Panel so that I can view them all together on screen. Is there a way to do this?
I am working from this example to resize an image :
http://aspnet.4guysfromrolla.com/articles/012203-1.2.aspx
I have converted most of the code to C# :
Response.Clear();
Response.ContentType = "image/jpeg";
System.Drawing.Image image = retrieveImage(strEncodedImage)...
I am displaying images from a database using the code below.
Is there any way I can resize the images before rendering them?
public void showSelectedImage(string strEncodedImage)
{
Response.Clear();
Response.ContentType = "image/jpeg";
System.Drawing.Image image...
I have images in my database that are stored as bytes, and I want to show them on screen on my webpage. I can do this with the code below :
Response.Clear();
Response.ContentType = "image/jpeg";
System.Drawing.Image image = retrieveImage(strEncodedImage)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.