ms-access


Filling a column with Case When Statement in reference to another column


I am fairly new to SQL language and I am trying to do some work for Uni in Access. I have three columns: Bindugen, with values shown below, and then blank Columns Code and 33/SDGL:
Bindungen: 33,811, / 811,SDGL,33,/ 33,812,SDGL, / 812,SDGL,/ 811, (etc.)
My main column is Bindungen and I want to fill the others in relation to that one. Basically in the column 33/SDGL I tried to do the Update Case When Statement shown below. It obviously didn't work.
SELECT
FROM Codes;
UPDATE (Codes)
SET 33/SDGL ( CASE
WHEN Bindungen = "*," THEN Allein
WHEN Bindungen = "33,*," Or "*,33," THEN 33
WHEN Bindungen = "SDGL,*," Or "*,SDGL," THEN SDGL
ELSE Both
END);
My goal for the 33/SDGL column is that when Bindungen is: "," = Allein / ",33," Or "33,," = 33 / ",SDGL," Or "SDGL,*," = SDGL
and for the rest = BOTH
Could someone help me write this SQL code?
Also for the Code column, I would like it to find from Bindungen which code is there (eg: 811 or 812). Can someone point me in the right direction?
MS Access does not use the CASE statement. You need to write a SWITCH statement instead, like this:
SWITCH(Bindungen = "*,", Allein, Bindungen = "33,*,", 33, Bindungen = "*,33,", 33,
Bindungen = "SDGL,*,", SDGL, Bindungen = "*,SDGL,", SDGL, BOTH)
Also note that in this situation, Allein, SDGL, and BOTH must ALL be fields that you are selecting from. If you just want the text instead of a field value, wrap those words in "double quotes".

Related Links

Does MS Access Runtime 2010 works well on system with previous version of Access/Office installed?
“Too many indexes on table” error when creating relationships in Microsoft Access 2010
Display related fields from another table on a Microsoft Access form
How to pass values from client side html to server side in classic asp or vbscript?
Access Report ignores DISTINCROW in query
checking whether field in table has space or comma - MS-Access
Forms and Subforms in Access 2003
EasyPHP connecting to MS Access
Access 2010 Runtime question
Access Input textbox on Data Access page with only select enabled to allow filter by searchs
Microsoft Access Query through VBA gets repeated?
What sort of functionality can I expect from exporting a Microsoft Access 2007 Database to a WSS 3.0 site?
query muliple fields with multiple values
Force OpenCurrentDatabase to use Access 2003
ACCESS/VBA: How to create a ON/OFF type switch to allow record modification on a form?
dsn for ms access 2003 in windows 7

Categories

HOME
winforms
gitlab
oracle11g
google-play
tinymce
homebrew
adb
programming-languages
react-redux
jsrender
twitter-bootstrap-4
c#-2.0
ckeditor
ebean
webrequest
dacpac
izpack
rascal
clearcase-ucm
opentracing
seaborn
transformation
excel-vba-mac
crystal-reports-2008
custom-wordpress-pages
autocad-plugin
orleans
tar
accessor
java-7
emgucv
windows-error-reporting
applozic
buck
kendo-datasource
c++-amp
procdump
winrt-xaml-toolkit
picasso
overlap
web-mining
bootstrapper
greenrobot-eventbus
graphenedb
mesos-chronos
email-templates
sql-server-agent
ibpy
isbn
galleria
apple-news
scrollable
pango
paxos
boost-multi-index
crypt
python-cryptography
or-tools
url-masking
impresspages
gstreamer-0.10
moveit
prettytensor
hover-over
whois
oauth2client
rhino-servicebus
itextpdf
photobucket
ford-fulkerson
wso2cloud
simple-framework
angular-leaflet-directive
0xdbe
mono-embedding
ami
npapi
jscript.net
knuth
codeigniter-routing
googlemock
article
elliptic-curve
wp-query
oracle-warehouse-builder
c18
.aspxauth
dexterity
back-stack
eventual-consistency
rabl
interface-orientation
limejs
libstdc++
multipage
twrequest
dotnethighcharts
work-stealing
external-accessory
django-tagging
web-application-design
jquery-ui-droppable
perfect-hash
nintendo-ds
sef
microsoft-virtualization
anti-piracy
mdac
signal-handling
lzh

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App