0
sqlite question
I'm having an issue using aliases.
This code:
<assign property="datasource:matchesdb-list.query" value="SELECT A.ID, A.PERSON1, A.PERSON2, B.NAME AS 'NAME1', C.NAME AS 'NAME2' FROM MATCHES AS A INNER JOIN PEOPLE AS B ON B.NAME = A.PERSON1 INNER JOIN PEOPLE AS C ON C.NAME = A.PERSON2 WHERE A.ID=?"/>
results in "Warning Database Error: no such column: B.NAME"
Any idea why this is happening? And also how I can display the those values in a feed/list?
Thanks
This code:
<assign property="datasource:matchesdb-list.query" value="SELECT A.ID, A.PERSON1, A.PERSON2, B.NAME AS 'NAME1', C.NAME AS 'NAME2' FROM MATCHES AS A INNER JOIN PEOPLE AS B ON B.NAME = A.PERSON1 INNER JOIN PEOPLE AS C ON C.NAME = A.PERSON2 WHERE A.ID=?"/>
results in "Warning Database Error: no such column: B.NAME"
Any idea why this is happening? And also how I can display the those values in a feed/list?
Thanks
Kundesupport af UserEcho
My guess would be that your schema is not what you presume it to be - the column may very well not exist.
So for People
1, Doug
2, John
3, Bob
4, Kev
and Matches
1, 1, 2 (where the first 1 is just the id/ the primary key?)
2, 3, 4
I could display
"1 Doug v 2 John"
"3 Bob v 4 Kev"
If that makes sense.
Thanks for your help.
<assign property="datasource:matchesdb-list.query" value="SELECT A.ID, A.PERSON1, A.PERSON2, B.FULLNAME AS 'NAME1', C.FULLNAME AS 'NAME2' FROM MATCHES AS A INNER JOIN PEOPLE AS B ON B.FULLNAME = A.PERSON1 INNER JOIN PEOPLE AS C ON C.FULLNAME = A.PERSON2 WHERE A.ID=1;"/>
<alert message="[datasource:matchesdb-list.dataSourceResultCount]"/>
But the alert is always displaying "0" and the rest of my code which creates the feed also displays nothing. Any suggestions would be appreciated. Thanks.
This will make sure that the query is completely done before throwing the alert.
https://studio.rarewire.com/wordpress/2012/10/sql-snippet/
http://stackoverflow.com/questions/6210289/take-column-username-in-each-row-and-split-each-username-into-player-1-player-2/6211060#6211060
I think something like this
http://stackoverflow.com/questions/8160671/sqlite-...
is closer to what I am doing.
I will try working on this again tonight and let you know if any of the suggestions helped. I am a bit worried that I may have left out autoincrementing the id or somehow made it not unique.
Thanks.