---
title: "problem med null i mysql"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/169401-problem-med-null-i-mysql"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "Vinnaren"
published: "2008-02-27T10:54:35.000Z"
updated: "2008-02-27T16:27:23.000Z"
replies: 2
views: 345
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/169401-problem-med-null-i-mysql"
---

# problem med null i mysql

## #1 — Vinnaren, 2008-02-27T10:54Z

Får inte följande att fungera:

```
SELECT CONCAT( u.firstName, ' ', u.lastName ) AS Name, p.title, p.date, p.leadTxt, p.bodyTxt, u.profileImage, 

(SELECT CASE lastupdate WHEN IS NULL THEN ' ' ELSE CONCAT('Uppdaterad', ' ', lastupdate) END AS 'lastupdate'
FROM edithistory AS eh 
WHERE eh.postID = p.postID 
ORDER BY lastupdate DESC 
LIMIT 1) AS lastupdate

AS lastupdate 
FROM post AS p 
INNER JOIN user AS u 
ON u.userID = p.userID
```

 

Får följande felmeddelande:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL THEN ' ' ELSE CONCAT( 'Uppdaterad' , ' ' , lastupdate ) END AS 'lastupda' at line 1 

Hur löser man detta med null??

Tacksam för all hjälp  :stud

Permalänk: https://www.webforum.nu/p/169401

## #2 — metalboy, 2008-02-27T11:16Z

Testa med

```
SELECT CASE WHEN lastupdate IS NULL THEN ' ' ELSE CONCAT('Uppdaterad', ' ', lastupdate) END AS lastupdate
```

Permalänk: https://www.webforum.nu/p/2085207

## #3 — Vinnaren, 2008-02-27T16:27Z

tack, fungerar kanon

Permalänk: https://www.webforum.nu/p/2085262

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/169401-problem-med-null-i-mysql
