sql create a field from a field

前端 未结 4 926
旧时难觅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:01

    Here is the query that fetches the two different fields:

    select iif(field like '*@*', field, NULL) as email,
           iif(field like '*@*, NULL, field) as address
    from t
    

    The usage of like in Access is a bit different from other databases.

    I would suggest that you create a view with this logic. If you actually want to modify the table, you will have to add columns and populate them with logic like the above.

提交回复
热议问题