sql create a field from a field

前端 未结 4 925
旧时难觅i
旧时难觅i 2021-01-23 18:48

I need to run a query that would pull information from a field that has 2 types of data .

Field is address and has 123 avenue as data and bb@yahoo.com.

I need to

4条回答
  •  深忆病人
    2021-01-23 19:14

    Try something like this:

    select *, 
           (case locate('@', address) when 0 then null else address) as email,
           (case locate('@', address) when 0 then address else null) as street
    from table;
    

    You'd probably need to adjust the name of "locate" function - I'm not sure if it is the same in access database.

提交回复
热议问题