![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
So what's the SQL for the entire query? Invalid Syntax, missing operand, non quoted text or invalid char/comma. What error? I thought bthis would do it but keep getting errors IIf([Sortie].[Result] = "RTB", "1", "0,5") I'm making a query where I want to create a new column with a value based on another columns content The source will contain either of 4 3-letter acronyms (RTB, MIA, RES, KIA). the new coumn should check this and assign a value of 1 for RTB and 0,5 for all others. How would I do this? |
#12
| |||
| |||
|
|
SELECT Persona.PersonaID, UnitType.Main, Sortie.Result FROM (Member INNER JOIN Persona ON Member.GameName = Persona.GameName) INNER JOIN (UnitType INNER JOIN Sortie ON UnitType.Unit = Sortie.Unit) ON Persona.PersonaID = Sortie.PersonaID GROUP BY Persona.PersonaID, UnitType.Main, Sortie.Result, Sortie.Started, Sortie.Ended, Sortie.TOM, Sortie.Valid HAVING (((UnitType.Main)="Infantry") AND ((Sortie.Started)>=#7/22/2010#) AND ((Sortie.Ended)<=#7/23/2010#) AND ((Sortie.TOM)>=3) AND ((Sortie.Valid)="Yes")) ORDER BY Persona.PersonaID; |
|
That's the sql before I try to add the IIF(), can't show with is as Access keeps throwing up the error requester and can't switch to SQL view without removing the code. Douglas J. Steele wrote: So what's the SQL for the entire query? Invalid Syntax, missing operand, non quoted text or invalid char/comma. What error? I thought bthis would do it but keep getting errors IIf([Sortie].[Result] = "RTB", "1", "0,5") I'm making a query where I want to create a new column with a value based on another columns content The source will contain either of 4 3-letter acronyms (RTB, MIA, RES, KIA). the new coumn should check this and assign a value of 1 for RTB and 0,5 for all others. How would I do this? |
#13
| |||
| |||
|
|
"Thomas Andersson" <thomas (AT) tifozi (DOT) net> wrote in news:8coc5mFkkkU1 (AT) mid (DOT) individual.net: SELECT Persona.PersonaID, UnitType.Main, Sortie.Result FROM (Member INNER JOIN Persona ON Member.GameName = Persona.GameName) INNER JOIN (UnitType INNER JOIN Sortie ON UnitType.Unit = Sortie.Unit) ON Persona.PersonaID = Sortie.PersonaID GROUP BY Persona.PersonaID, UnitType.Main, Sortie.Result, Sortie.Started, Sortie.Ended, Sortie.TOM, Sortie.Valid HAVING (((UnitType.Main)="Infantry") AND ((Sortie.Started)>=#7/22/2010#) AND ((Sortie.Ended)<=#7/23/2010#) AND ((Sortie.TOM)>=3) AND ((Sortie.Valid)="Yes")) ORDER BY Persona.PersonaID; Why are you using a TOTALS query? a simple SELECT query would work. |
#14
| |||
| |||
|
|
Bob Quintal wrote: "Thomas Andersson" <thomas (AT) tifozi (DOT) net> wrote in news:8coc5mFkkkU1 (AT) mid (DOT) individual.net: SELECT Persona.PersonaID, UnitType.Main, Sortie.Result FROM (Member INNER JOIN Persona ON Member.GameName = Persona.GameName) INNER JOIN (UnitType INNER JOIN Sortie ON UnitType.Unit = Sortie.Unit) ON Persona.PersonaID = Sortie.PersonaID GROUP BY Persona.PersonaID, UnitType.Main, Sortie.Result, Sortie.Started, Sortie.Ended, Sortie.TOM, Sortie.Valid HAVING (((UnitType.Main)="Infantry") AND ((Sortie.Started)>=#7/22/2010#) AND ((Sortie.Ended)<=#7/23/2010#) AND ((Sortie.TOM)>=3) AND ((Sortie.Valid)="Yes")) ORDER BY Persona.PersonaID; Why are you using a TOTALS query? a simple SELECT query would work. Hmm, guess it was left over after some experimenting. doesn't make a difference to my problem though. IIf just WON'T work for me. Spelling is correct, no extra commas, all text quoted, only one opperand (tried both "=" and "like"). Tried [Sortie.][Result] as well as [Result] and Access keeps giving me the same syntax error. This have me really confused as by everything i can find it SHOULD work. |
#15
| |||
| |||
|
|
Bob Quintal wrote: "Thomas Andersson" <thomas (AT) tifozi (DOT) net> wrote in news:8coc5mFkkkU1 (AT) mid (DOT) individual.net: SELECT Persona.PersonaID, UnitType.Main, Sortie.Result FROM (Member INNER JOIN Persona ON Member.GameName = Persona.GameName) INNER JOIN (UnitType INNER JOIN Sortie ON UnitType.Unit = Sortie.Unit) ON Persona.PersonaID = Sortie.PersonaID GROUP BY Persona.PersonaID, UnitType.Main, Sortie.Result, Sortie.Started, Sortie.Ended, Sortie.TOM, Sortie.Valid HAVING (((UnitType.Main)="Infantry") AND ((Sortie.Started)>=#7/22/2010#) AND ((Sortie.Ended)<=#7/23/2010#) AND ((Sortie.TOM)>=3) AND ((Sortie.Valid)="Yes")) ORDER BY Persona.PersonaID; Why are you using a TOTALS query? a simple SELECT query would work. Hmm, guess it was left over after some experimenting. doesn't make a difference to my problem though. IIf just WON'T work for me. Spelling is correct, no extra commas, all text quoted, only one opperand (tried both "=" and "like"). Tried [Sortie.][Result] as well as [Result] and Access keeps giving me the same syntax error. This have me really confused as by everything i can find it SHOULD work. |
#16
| |||
| |||
|
|
Hmm, guess it was left over after some experimenting. doesn't make a difference to my problem though. IIf just WON'T work for me. Spelling is correct, no extra commas, all text quoted, only one opperand (tried both "=" and "like"). Tried [Sortie.][Result] as well as [Result] and Access keeps giving me the same syntax error. This have me really confused as by everything i can find it SHOULD work. Have you tried using a simplified IIf statement? test1: iif(True,1,2) If that works, then try test1: iif(True,1,1/2) then substitute your field names |
#17
| |||
| |||
|
|
Bob Quintal wrote: Hmm, guess it was left over after some experimenting. doesn't make a difference to my problem though. IIf just WON'T work for me. Spelling is correct, no extra commas, all text quoted, only one opperand (tried both "=" and "like"). Tried [Sortie.][Result] as well as [Result] and Access keeps giving me the same syntax error. This have me really confused as by everything i can find it SHOULD work. Have you tried using a simplified IIf statement? test1: iif(True,1,2) If that works, then try test1: iif(True,1,1/2) then substitute your field names Yes I have, same error :/ My Access must be broken or something :P |
![]() |
| Thread Tools | |
| Display Modes | |
| |