Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substringing in mysql 1

Status
Not open for further replies.

sowbug

Programmer
Jan 13, 2003
5
US
The query below is a db2 query I have tried to use in mysql. I am getting the error: "Field SSN doesn't exist" when I know that it does. Also if I specify the db and table(i.e. db0.table1.SSN) I get and error saying the table doen't exist. New to mysql/Using MySQLYog client. Anybody know whY?????

SELECT SUBSTRING('000000'||CHAR(SSN) ,5,5)
, STATUS_CODE
, DATE_SEPARATION, CONTR_AT_SEP
, INTEREST_AT_SEP, YTD_REFUNDED_INEST
, REFUND_DATE, MEM_BAL_FWD_CONTRI
, YR_END_ACTUARY_STA
, PREV_INCORRECT_SSN
, DATE_SSN_CORRECTED, DATE_ADDED
, ACTV_DATE, NON_ASM_FLA
, PRIOR_YR_CONTRIB, ATHK_FLAG
, STAR_FLAG, PRE_TAX_CONTR
, 'CNVTD'
, 'CNVTD', DATE_LAST_MAIN
FROM db0.table1
WHERE db0.table1.NAME LIKE 'REFUND%'
AND db0.table1.SSN < 1000
UNION ALL
 
|| means or in Mysql, use the function concat instead

SELECT SUBSTRING(concat('000000',SSN) ,5,5)

Union is not supported prior to version 4
 
Thanks for the info, but I am still getting the same error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top