Benjamin Sayoc Benjamin Sayoc - 3 years ago 140
MySQL Question

SQL, Select Distinct and Left in one

I want to SELECT a number of rows in a SQL database using both

DISTINCT
and
LEFT
.

Below is the effort so far.

SELECT DISTINCT(alltext) LEFT(alltext, 100)
FROM programoversigter3
WHERE alltext LIKE '%kommunisme%'

Answer Source

DISTINCT is a keyword not a function and you need to use , after each column. So, your query should be

SELECT DISTINCT alltext, LEFT(alltext, 100)
FROM programoversigter3
WHERE alltext LIKE '%kommunisme%'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download