Reputation: 7
here's my query:
SELECT
p1.time_neu as Datum
count(p1.*) as Anzahl_Palette,
count(p2.*) as Anzahl_Stangen_Behaelter
FROM
00_Gesamt_Pickauf p1,
00_Gesamt_Pickauf p2
WHERE
p1.platz_von like '%-%-00-00' AND
p2.platz_von like ...
I've got trouble with the second like-condition. I want to select all the rows, where the "platz_von"-coloumn looks like this:
01-01-01-01
02-02-02-02
02-02-03-04
...
But not like this:
01-02-00-00
02-01-00-00
I need to filter all the rows where "platz_von" does not end on "-00-00". Any hints on how to write the query? Thanks!
Upvotes: 0
Views: 74
Reputation: 1
Just add NOT and change '%-%-00-00' to '%-00-00' since you only want exclude that end with 00-00
SELECT
p1.time_neu as Datum
count(p1.*) as Anzahl_Palette,
count(p2.*) as Anzahl_Stangen_Behaelter
FROM
00_Gesamt_Pickauf p1,
00_Gesamt_Pickauf p2
WHERE
p1.platz_von NOT LIKE'%-00-00' AND
p2.platz_von LIKE ...
Upvotes: 0
Reputation: 733
Try like this
SELECT
p1.time_neu as Datum
count(p1.*) as Anzahl_Palette,
count(p2.*) as Anzahl_Stangen_Behaelter
FROM
00_Gesamt_Pickauf p1,
00_Gesamt_Pickauf p2
WHERE
p1.platz_von NOT LIKE '%-00-00%' AND
p2.platz_von like ...
Upvotes: 0
Reputation: 83215
SELECT
p1.time_neu AS Datum
count(p1.*) AS Anzahl_Palette,
count(p2.*) AS Anzahl_Stangen_Behaelter
FROM
00_Gesamt_Pickauf p1,
00_Gesamt_Pickauf p2
WHERE
p1.platz_von like '%-%-%-%' AND
NOT (p1.platz_von like '%-%-00-00')
Upvotes: 1