as issue

29 views
Skip to first unread message

John Currey

unread,
Jan 25, 2023, 7:47:26 PM1/25/23
to SDQL API
Notice the output of this query. I'd expect to see 2 values returned, but there is only 1. 

tS(quarter scores[0] as 'P1'>o:quarter scores[0]) as 'o:P1' , tS(quarter scores[0] as 'P1'<o:quarter scores[0]) as 'o:P1'@ team and season=2022


In poking around in debugging, I noticed that removing the second "as" clause causes it to work as expected. Removing the 1st "as" clause seemingly has no affect. 


Jan25.png

Joe Meyer

unread,
Jan 26, 2023, 5:11:08 PM1/26/23
to sdq...@googlegroups.com
John and SDQL API Friends,

each field requires a unique name and you are naming two fields 'o:P1' 

Best regards,

Joe Meyer
Sports Database LLC

--

---
You received this message because you are subscribed to the Google Groups "SDQL API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sdqlapi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sdqlapi/4ed276db-9008-4e1c-a7c5-1dcaef7218adn%40googlegroups.com.

John Currey

unread,
Jan 26, 2023, 7:43:31 PM1/26/23
to SDQL API
Thanks Joe, sorry for the dumb mistake.

John Currey

unread,
Jan 27, 2023, 8:22:13 AM1/27/23
to SDQL API
Technically, I'm not really naming two fields "o:P1", I'm naming a single field "o:P1" (i.e. o:quarter scores[0] as 'o:P1'), and using twice in the same query for different, but valid reasons. As you can see, I'm trying get the 1st quarter SU records by team for 2022. Of course, doing so long hand is easy and makes sense. But in making a shortcut P1 for quarter scores[0], I really want to use the "as" alias name, and I have reason to need it twice in the same query.

My goal is to write this query "tS(P1>o:P1),tS(P1<o:P1),tS(P1=o:P1)@team and season", which fails because of the reuse of the alias. I can use "margin after the first>0" or "M1>0" and it works. It seems reasonable that a user may try  "tS(P1>o:P1),tS(P1<o:P1)@team and season", so I work on coding around the limitation. 

Thanks for helping me think it through.

John

John Currey

unread,
Jan 27, 2023, 6:26:14 PM1/27/23
to SDQL API
OK, scratch all that. I think I see what I'm doing wrong. Thanks again.
Reply all
Reply to author
Forward
0 new messages