Archive for the 'select distinct' Category

MS Word formatting – How do I create a document with 2 independent columns insted of vertically wrapped column

I am trying to create a word document that has two distinct columns throughout the entire document. When I select "two columns" they wrap. The bottom of the left column goes to the top of the right column and the bottom of the right column goes to the top of the left column on the [...]

organizing imperfect data in a database table?

I have a database table w 500,000 user-entered records.
1 of the table columns contains “company names” and I want to get a list of each company in alphabetical order.
Normally, I’d do something like “select distinct company_name from table order by 1”
However, there is no uniform input method for company name:
typos are common (e.g. citigrup instead [...]

SQL Query to select ordered/unique entries…?

i have this table here….
http://tinypic.com/r/j7fe3o/3
i have to select rows from this table, which have a certain AssignmentID and a Distinct StudentID, but with the highest ID (which is an auto incrementing index).
i can successfully get the records by using a group by statement but it gives me the record with the least id in the [...]

Is my SQL statement correct? Can you help to take a look and fix please? Thanks! It’s short!?

Write the SQL statement list the product names of all products that were not ordered in the month of August 2000
SELECT ProductName
FROM Products
WHERE Products.ProductID IN(
SELECT DISTINCT ProductID
FROM Orders, [Order Details]
WHERE not datepart (mm, Orders.OrderDate) = 8
AND datepart (yy, Orders.OrderDate) = 2000 )
SELECT ProductName
FROM Products
INNER JOIN Orders ON Orders.ProductID=Products.ProductID
WHERE not datepart (mm, Orders.OrderDate) = 8
AND [...]

When i try to do this Query in SQL using microsoft access, it comes with, "Enter Parameter Value" for Unsold..

Please, anyone help ??? Why is it doing that??
SELECT DISTINCT MAX (Price) AS [Maximum], MIN (Price) AS [Minimum]
FROM SaleProperty
WHERE PropertyStatus = ‘Unsold’;
well i think you wrote the query wrong
why r u writing "AS [Maximum] or AS [Minimum]"
it is an sql query you cannot create a variable into sql queries
remove those
and your query should be
SELECT DISTINCT [...]

In SQL, how could I write this statement?

I want to select all the distinct postcodes from a table as well as how many of each there are?
Thanks!
Select
postcode, count(*) as count
from
table
group by postcode

How to echo mysql results? =(?

I know how to return values from a mysql result when im just selecting rows,
but how can i return these values from a statement like this
SELECT DISTINCT column_name(s)
FROM table_name
It’s exactly the same method – you’re still returning rows but you’re only returning unique ones.

How to echo mysql results? =(?

I know how to return values from a mysql result when im just selecting rows,
but how can i return these values from a statement like this
SELECT DISTINCT column_name(s)
FROM table_name
It’s exactly the same method – you’re still returning rows but you’re only returning unique ones.

Can you help me with these probability problems?

1) In a lottery game a player chooses six distinct numbers from 1 to 49. In how many ways can a player select the six numbers?
- I tried using the Distinguishable Permutation formula but that didn’t give me the correct answer (which is 13,983,816 by the way). I then tried doing a combination…Which didn’t [...]

solution + Prove that from any set of ten distinct two-digit numbers (in the decimal system), it is possible t

solution + Prove that from any set of ten distinct two-digit numbers (in the decimal system), it is possible to select two disjoint, non-empty subsets whose members have the same sum
If false, then all disjoint sums are distinct. So how many are there? Essentially, pick some terms and then pick some terms from what’s [...]