Subscribe to this thread
Home - General / All posts - update column after choose non null value
lionel

995 post(s)
#16-Apr-18 23:59

Hi

How i can choose the best virtual column ( AS first , AS second ) to insert the first non null value in a third column of name adresse ?

if first and second are both null best then is insert default text " no adress " or " no result"

Regard's

Attachments:
update_column.mxb
update_column.png


Book about Science , cosmological model , Interstellar travels

Boyle surface fr ,en

tjhb
10,094 post(s)
#17-Apr-18 01:27

The short answer is, use Coalesce():

SELECT Coalesce([first][second]'no result'AS [adresse]

FROM ...

Your example code can also be made more efficient, but doing that might hide the general answer. If you want help with that, just ask.

Dimitri


7,413 post(s)
#17-Apr-18 07:57

There are short, but useful, citations of using Coalesce in the manual. Look it up using the index, and then Ctrl-F in your browser to find instances of Coalesce in the resulting pages.

lionel

995 post(s)
#17-Apr-18 02:16

thank' i think i ll succeed ...

Fehily SQL p 165 checking for null with COALESCE()

CASE has shortland call Coalesce() and NULLIF()

Access use Switch()


Book about Science , cosmological model , Interstellar travels

Boyle surface fr ,en

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.