I'm trying to get the 3rd query to return a varchar, but it returns an integer.
Query one to prove that a varchar can be returned:
[code=mysql]
SELECT IF(1=1,0,'one') , IF(1=0,0,'one') ;
+-----------------+-----------------+
| IF(1=1,0,"one") | IF(1=0,0,"one") |
+-----------------+-----------------+
| 0 | one |
+-----------------+-----------------+
[/code]
Query two to prove that I can return an integer(Coached ByContactID):
[code=mysql]
rs = st.executeQuery ("SELECT Title, Author, OwnerID, ResponsiblePers onID, Synopsys, if(ResponsibleP ersonID=0,(SELE CT CoachedByContac tID FROM details WHERE ContactID=6),Ow nerID) as Myfield FROM book WHERE BookID=" + BookID);
[/code]
Query three is my problem because I want to return a varchar(UserNam e instead of CoachedByContac tID ) but it returns an integer:
[code=mysql]
rs = st.executeQuery ("SELECT Title, Author, OwnerID, ResponsiblePers onID, Synopsys, if(ResponsibleP ersonID=0,(SELE CT UserName FROM details WHERE ContactID=6),Ow nerID) as Myfield FROM book WHERE BookID=" + BookID);
[/code]
Query one to prove that a varchar can be returned:
[code=mysql]
SELECT IF(1=1,0,'one') , IF(1=0,0,'one') ;
+-----------------+-----------------+
| IF(1=1,0,"one") | IF(1=0,0,"one") |
+-----------------+-----------------+
| 0 | one |
+-----------------+-----------------+
[/code]
Query two to prove that I can return an integer(Coached ByContactID):
[code=mysql]
rs = st.executeQuery ("SELECT Title, Author, OwnerID, ResponsiblePers onID, Synopsys, if(ResponsibleP ersonID=0,(SELE CT CoachedByContac tID FROM details WHERE ContactID=6),Ow nerID) as Myfield FROM book WHERE BookID=" + BookID);
[/code]
Query three is my problem because I want to return a varchar(UserNam e instead of CoachedByContac tID ) but it returns an integer:
[code=mysql]
rs = st.executeQuery ("SELECT Title, Author, OwnerID, ResponsiblePers onID, Synopsys, if(ResponsibleP ersonID=0,(SELE CT UserName FROM details WHERE ContactID=6),Ow nerID) as Myfield FROM book WHERE BookID=" + BookID);
[/code]
Comment