Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sikharma13
Starting Member
44 Posts |
Posted - 2013-11-15 : 07:27:52
|
update ed_abcdeeh set category = case when name_of_school = '' then category = 'No Facility' else '' end,status = case when name_of_school = '' then status = 'Non-Compliant' else 'Compliant' end.how make this query right..when name of school is blank i want to update my category to No facility, but if the name of school has data it will just make itblank. same to the status.. thanks!VFP9.0 via MySQL 5.0 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-15 : 07:37:22
|
[code]update ed_abcdeeh set category = case when name_of_school = '' then 'No Facility' else '' end,status = case when name_of_school = '' then 'Non-Compliant' else 'Compliant' end[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sikharma13
Starting Member
44 Posts |
Posted - 2013-11-15 : 07:43:41
|
i have already tried that sir.. but it turns out that my output becomes 1 or 0.. i dont know how did that happen..VFP9.0 via MySQL 5.0 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-15 : 07:46:23
|
quote: Originally posted by sikharma13 i have already tried that sir.. but it turns out that my output becomes 1 or 0.. i dont know how did that happen..VFP9.0 via MySQL 5.0
whats the datatype of category and status fields?In SQL Server its working fine for me. Dunno about MySQL as you've posted in T-SQL forum and there're not many experts on MySQL here.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sikharma13
Starting Member
44 Posts |
Posted - 2013-11-15 : 07:51:20
|
`CATEGORY` varchar(55) default NULL,`STATUS` varchar(15) default NULL,Its ok sir, as what i am seeing.. SQL server queriesare not that quite different to mysql.. its almostthe same.. but what i am thinking right now..everytime i update them.. i am getting values 1 or 0.VFP9.0 via MySQL 5.0 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-15 : 08:59:02
|
quote: Originally posted by sikharma13 `CATEGORY` varchar(55) default NULL,`STATUS` varchar(15) default NULL,Its ok sir, as what i am seeing.. SQL server queriesare not that quite different to mysql.. its almostthe same.. but what i am thinking right now..everytime i update them.. i am getting values 1 or 0.VFP9.0 via MySQL 5.0
you wont get result as 1 and 0 as per your posted query,atleast in sqlserver. And I dont think it will be different in MySQL either!------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|