7 Replies - 871 Views - Last Post: 10 May 2016 - 12:20 AM

#1 Bonekit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-May 16

UPDATE Multiple IIF

Posted 09 May 2016 - 01:34 AM

Hello Guys,

I have a problem with SQL, so i hope you can help me.
My Code is:
 UPDATE Umfrage2 
SET Gruppen = IIF(Alter <=8, "Kinder")
IIF(Alter 9, "Jugendliche")



My Error in short: "Syntax Error in Query"
What i want to do is:
I want to update a table, with this information:
IIF(Age <= 8, "Kids")
IIF(Age 9 to 13, "young")
and so on.

I need a tip not more.

Regards,
Bonekit

Is This A Good Question/Topic? 0
  • +

Replies To: UPDATE Multiple IIF

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4138
  • View blog
  • Posts: 13,074
  • Joined: 08-June 10

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 01:43 AM

IIF() is not a valid MySQL function.
Was This Post Helpful? 0
  • +
  • -

#3 Bonekit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-May 16

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 02:00 AM

Oh, sorry i forgot, i use Access 2016 SQL. I thought there is no difference between sql and mysql.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4138
  • View blog
  • Posts: 13,074
  • Joined: 08-June 10

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 02:15 AM

so should the thread be moved to access?
Was This Post Helpful? 0
  • +
  • -

#5 Bonekit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-May 16

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 02:31 AM

View PostDormilich, on 09 May 2016 - 02:15 AM, said:

so should the thread be moved to access?


Yes, please.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is online

  • say what now
  • member icon

Reputation: 6409
  • View blog
  • Posts: 25,892
  • Joined: 12-December 12

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 09:56 AM

You need to nest the IIF functions.

You also first need to read up on the functions as they require 3 parts.

IIf Function
Was This Post Helpful? 1
  • +
  • -

#7 Bonekit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-May 16

Re: UPDATE Multiple IIF

Posted 09 May 2016 - 11:27 PM

Hello again,

So i used this code and i have the same error.
UPDATE Umfrage2 
SET Gruppen = IIF([Alter] <=8, "Kinder", IIF([Alter] BETWEEN 9 AND 13, "Jugendliche));


I read everything in the link above, i have no idea what i should do now.

This post has been edited by andrewsw: 10 May 2016 - 10:10 AM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#8 Bonekit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 71
  • Joined: 09-May 16

Re: UPDATE Multiple IIF

Posted 10 May 2016 - 12:20 AM

Done! Thanks for the help guys, i forgot a ".
UPDATE Umfrage2 
SET Gruppen = IIF([Alter] <=8, "Kinder", IIF([Alter] BETWEEN 9 AND 13, "Jugendliche", IIF([Alter] BETWEEN 14 AND 19, "Junge Erwachsene",
IIF([Alter] BETWEEN 20 AND 39, "Erwachsene", IIF([Alter] BETWEEN 40 AND 59, "Ältere Erwachsene", IIF([Alter] >= 60, "Senioren"))))));

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1