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

457 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


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

tjhb

8,215 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


4,980 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

457 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()


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

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