Jump to content

Search the Community

Showing results for tags 'distinct'.

  • 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 3 results

  1. Hi There, I have two questions about SQL syntax, the first one is about "SELECT DISTINCT" and the other is "NOT". Question 1: For example, "Customers" table has fields including CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country. From my understanding, if my SQL statement is SELECT DISTINCT Country FROM Customers; then it will show the list of unique countries. However, I'd like to know what does it mean if my SQL statement is SELECT DISTINCT Country, City, CustomerName FROM Customers; ? Why I don't have to write SELECT DISTINCT Country, DISTINCT City, DISTINCT CustomerName? You may refer to this session: https://www.w3schools.com/sql/sql_distinct.asp Question 2: I'm working on the session, and there's an example as below: I understand that this example would like to exclude BOTH Country = "Germany" and Country = "USA", but I don't understand why using the operator [AND] instead of [OR]? Doesn't [AND] represent the intersection while [OR] mean union? So, if I want to exclude BOTH "Germany" and "USA", why I can't use [OR] as the operator in this example?
  2. 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
  3. I am wondering why this is not working. I have a table of order line items. each order can have multiple line items with the same transaction ID just different item codes. I am trying to find single transaction ID's with a specific item code. I also tried doing a count (transactionnumber)<2 but could not figure out how to add a where for the item number. So an order for just this item select distinct(transactionnumber) from Orders (I thought this would select any unique transaction number IE only one occurance)where Code='9987' When I run the above and check the transaction numbers it is any transaction with that code not transactions with only that code? I also tried this select * from OrdersWhere (select COUNT(transactionnumber)from Device_Orders) <2 and ItemCode='9987' This returns no records when I know there are single transaction numbers with that item code? Any suggestions would be appreciated
×
×
  • Create New...