Hello CodeProject,
currently i'm writing an app for an landlord/lesser.
I have created a table which have a column "Muell", defined as decimal(6,2).
I'm using an Inputfield with
SELECT distinct CONCAT(e.Miete, " €") AS Miete,
as default content. If the user changes the field, and leaves the "€" i'm running into an error.
I'm using that statement:
UPDATE tbl_nebenkosten
SET Muell = '$Muell',
Wasser = '$Wasser',
Versicherung = '$Versicherung',
Strom = '$Strom',
Hausverwaltung = '$Hausverwaltung',
Heizung = '$Heizung'
WHERE MieterID = '${state.MieterID}'
I read
MySQL SUBSTRING_INDEX() function - w3resource[
^]. On that page just a example with "SELECT" is given.
In my case i need UPDATE instead.
Sadly i just started programming with SQL, so many is new for me.
What I have tried:
UPDATE tbl_nebenkosten
SET Müll = SELECT SUBSTRING_INDEX('$Muell',' ',1)
Wasser = '$Wasser',
Versicherung = '$Versicherung',
Strom = '$Strom',
Hausverwaltung = '$Hausverwaltung',
Heizung = '$Heizung'
WHERE MieterID = '${state.MieterID}'
That one gives me an error.