Jump to content

Search the Community

Showing results for tags 'count'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 11 results

  1. Tauheed

    MySQL query help

    I don't have MySQL experience, I need some help to write a query for my work. I need a query that count transaction for a week, for example, I wanna run the query every Friday and want to see the result from last Friday to Thursday, I mean just last week's data. The start date is last Friday (11/12/2021) and the End date is Thursday (11/18/2021). It is a weekly process that I can run every week to download the output. There are two tables, sales, and customers. The customer table has fields such as "customer_id", FirstName, LastName, etc and the sales table has "id" which is the same as customer_id from customer table, salesDate, etc. I want to count data of those who are customer_id match to the sales table. I would like to ignore some of the users as well like our IT team has a couple of test users that uses for testing. for example testuser1 and testuser2. I would like the query to not count these two users. Here is an example that I want to make work. Can someone please help me to write the query? SELECT COUNT(CustomerID) AS NumberOfCustomer FROM Customer INNER JOIN Sales ON ID = CustomerID where user != (testuser1 and testuser2 where sales date between last Friday to Thursday; Thanks!
  2. So I'm trying to filter some records out of my select inside a form on my website. Problem is that I currently have this setup: Database Table1 Time Number Table2 Number Something I'm trying to filter time by checking how many records show up of number in table2 So basically I select time from table1 where number is less than <some amount> in table2 How do I actually put that in sql? I currently have this but it isn't working: SELECT Time FROM Showcase WHERE Number IN (SELECT COUNT(Number) FROM Build WHERE COUNT(Number) < 50); it currently doesn't end up with anything but in theory it should show the times from the records where the count of the value of number is less than 50 so if Number = 40 and it gets counted 70 times it shouldn't show up. but if Number = 30 is counted 29 times it should show up can anyone tell me what is going wrong?
  3. Jay

    SQL Newbie

    I have created a query that has given me a list of printed letters for a specific day which is great. I am now trying to create a column that will add a count so the receiver of the report will know how many letters printed that day. Any advice?
  4. <?php if (empty($count)) { $count=''; } if ($count == '') { $count ='1'; } else { $count++ ; } echo $count; echo '<br>'; ?> My goal is to make a script that increments $count ever time someone downloads the page. Can this be done without 'storing' the $count value? Or should I create a script with fwrite/fopen or $_SESSION?
  5. honkmaster

    SQL count help

    Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
  6. hi, sorry, i have a question to do...but i know how to write in sql query ....however the answer need to write on relational algebra in query is like : SELECT * FROM operation where r='broken' group by pc having count(pc) >1 ; π id,pc,result ( σ r = 'broken' (operation)) like group by and having clasue...i no idea ... i searched on internet still @@ .... isnt the answer like that, i using split/step by step method to do rel 1 = σ r = 'broken' (operation) rel 2 = σ count(pc)>1 γ pc,count(pc) (rel 1)) rel 3 = π id,pc,result (rel 2 ) thanks
  7. id | mid | pid | owgh | nwgh |1 3 12 1.5 0.62 3 12 1.5 0.33 3 14 0.6 0.44 3 15 1.2 1.15 4 16 1.5 1.06 4 17 2.4 1.27 3 19 3.0 1.4 Select mid , COUNT(distinct pid) as cpid , SUM(nwgh) as totalnwgh from test GROUP BY mid sqlfiddle : link of below result with above query mid cpid totalnwgh3 4 3.84 2 2.2 But above i need one more column that's as below : **totowgh** mid cpid totalnwgh totowgh3 4 3.8 6.3 (DISTINCT value as per pid column)4 2 2.2 3.9 where totowgh = 6.3 come by DISTINCT value as per pid columnthat's mid = 3 has count 5 but distinct pid = 4 for mid=3 same way "distinct" owgh = 6.3 for mid=3 and distinct pid.As pid=12 is count 1 time hence,1.5 + 0.6 + 1.2 + 3 = 6.3 ( please not this is as per DISTINCT value of pid )Please note : i need owgh value as per distinct pid or group by pid .. because if i replace value of owgh 0.6 with 1.5 then it will be 5.7 instead of 7.2 but value of owgh 0.6 belong to pid = 14 and not pid = 12 hence totalcount of owgh change ...but i need is 7.2SEE WHAT I MEANS : sqlfiddle.com/#!9/2a53c/6
  8. I have a mySQL posts table, a files table, and a relationships table. I need to sum file download counts grouped by the post the files are associated with. SELECTp.id, p.post_title, count(d.download_id) FROM posts p INNER JOIN file_log d ON p.id = d.file_idgroup by p.post_title The above query works as long as the titles of the files are the same, which is not always the case. I really need to group them by their relationship to the post they are associated with. The relationships are stored in relationships r, which shows r.post_id (which is p.id from posts), and r.file_id (which is d.file_id from file_log) I have tried a few subqueries, but I am not sure how to join the relationships table to my query and group counts by r.post_id Thanks for any help.
  9. Here is my xml: <?xml version='1.0' encoding='UTF-8'?><wd:Report_Data xmlns:wd="urn:com.workday.report/CR-INT034-ADP-Garnishment_Disbursements_File-Outbound2"> <wd:Report_Entry> <wd:field>1111</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>2222</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>3333</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>2222</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>3333</wd:field> </wd:Report_Entry> <wd:Report_Entry> <wd:field>1111</wd:field> </wd:Report_Entry></wd:Report_Data> Here is the xslt I am using: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:wd="urn:com.workday.report/CR-INT034-ADP-Garnishment_Disbursements_File-Outbound2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="2.0"><xsl:strip-space elements="*"/><xsl:output indent="no" method="text" /> <xsl:key name="entry" match="wd:Report_Entry" use="wd:field" /> <xsl:template match="wd:Report_Data"> <xsl:value-of select="count(wd:Report_Entry | wd:field[ generate-id() = generate-id(key('entry', wd:field))])"/> </xsl:template> </xsl:stylesheet> I am trying to count the unique values. So in the example above, the answer should be 3 and I am getting 6. I can get this to work in 1.0 with the following code: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:wd="urn:com.workday.report/CR-INT034-ADP-Garnishment_Disbursements_File-Outbound2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0"><xsl:strip-space elements="*"/><xsl:output indent="no" method="text" /> <xsl:key name="entry" match="wd:Report_Entry" use="wd:field" /> <xsl:template match="wd:Report_Data"> <xsl:value-of select="count(wd:Report_Entry [ generate-id() = generate-id(key('entry', wd:field))])"/> </xsl:template> </xsl:stylesheet> But I can't use 1.0 I have to use 2.0. Is there any way to get this to work in 2.0 or am I just out of luck? Any help would greatly be appreciated! Thanks,Sarah
  10. I am trying to create an xref and cannot get the correct step number in the reference. I am pointing at the cmd tag because when I point at the step tag, it does not link to a page number. The below code (second set) counts all the preceding cmd tags in the whole document. Is there a way to count only the cmd tags in the current task/topic? I have tried creating variables (shown directly below), and this gets me to the correct task number in the document. From there, I could not get it to count the preceding cmd tags in the task in the CurrTask position. Any help on this is greatly appreciated. <xsl:variable name="Tasks" select="count(preceding::*[contains(@class, ' task/steps ')])" /> <xsl:variable name="CurrTask" select="$Tasks +1" /> <xsl:template match="*[contains(@class, ' task/cmd ')]" mode="retrieveReferenceTitle"><xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Step'"/> <xsl:with-param name="theParameters"> <number> <xsl:value-of select="count(preceding::*[contains(@class, ' task/cmd ')]) + 1"/></number></xsl:with-param> </xsl:call-template> </xsl:template> Alternatively, when I point the xref at the step, and insert <fo:inline id="{@id}"/> and <xsl:call-template name="insertPageNumberCitation"/> at the end of the template, it gives me the page number of the actual xref, not the page number of the step it is pointing at. Thank you.
  11. I have a table of orders. Each order has a status, one being "Shipped". The end goal is to take the data and push it into a chart showing total orders, shipped orders, and grouped by month/year. I can get the count of the orders and group them by month/year, but I'm not sure how to also include orders with the status of "Shipped". Any ideas? (The code I have now is counting the orders into a column called Orders and Shipped, but I know it's not actually grabbing shipped orders for the Shipped column. I just have it there for now so I could move on with populating a chart while I work on fixing the query.) SELECT COUNT(o.ROW_ID) AS Orders, COUNT(o2.ROW_ID) AS Shipped, RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5) AS Date, MONTH(o.STATUS_DT) AS Month, YEAR(o.STATUS_DT) AS YearFROM dbo.S_ORDER AS o LEFT OUTER JOIN dbo.S_ORDER AS o2 ON o.ROW_ID = o2.ROW_IDWHERE (o.CREATED > CONVERT(DATETIME, '2011-04-01 00:00:00', 102)) AND (o.CREATED < CONVERT(DATETIME, '2012-05-1 00:00:00', 102))GROUP BY RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5), MONTH(o.STATUS_DT), YEAR(o.STATUS_DT)ORDER BY Year, Month, Date DESC
×
×
  • Create New...