switch true & false (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


barking mad -> switch true & false (6/24/2009 8:06:43)

in a nutshell:

I'm writing a query which can be used to export data from client's access database that can be used ina bulk import program to update their online store.

However they have a field called internet which as far as they're concerned if true means yes show on webshop, however my cart has a corresponding field called hide which if true hides the product from view on the web shop. So in otherwords the true statement has opposite meanings.

I would like to amend my sql query on the access database to switch the true statement to false if true, and true if false... make sense?

any ideas?




TexasWebDevelopers -> RE: switch true & false (6/24/2009 11:11:43)

So you want to run a query that amends the data in the Access database so that when you finally bulk import the data will correspond?




barking mad -> RE: switch true & false (6/24/2009 11:20:43)

yes & convert the field which at teh moment is true or false to actually output the opposite ie true > false & false > true

I've tried including case ... but get a syntax error

here's my (abbreviated ie withou too many fields) code so far (i'm joining three tables)

SELECT tblProduct_Master.PLU AS catalogid, 
tblProduct_Master.Internet AS nothide, 
case tblProduct_Master.Internet when TRUE then FALSE when FALSE then TRUE end as hide 
FROM (tblCategory INNER JOIN tblProduct_Master ON tblCategory.Category = tblProduct_Master.Category) INNER JOIN tblProduct_Master_StockLevel ON (tblProduct_Master.PLU = tblProduct_Master_StockLevel.PLU) AND (tblProduct_Master.PLU = tblProduct_Master_StockLevel.PLU)
ORDER BY tblProduct_Master.PLU;


The error is
Syntax error (missing operator) in query expression 'case tblProduct_Master.Internet when TRUE then FALSE when FALSE then TRUE end'.

when I cancel the tblProduct_Master is highlighted immediately AFTER the word case.




TexasWebDevelopers -> RE: switch true & false (6/24/2009 16:00:04)

What is the format your are exporting to (that the bulk import program will import from)?




barking mad -> RE: switch true & false (6/25/2009 5:17:11)

at the moment I'm just creating the initial Access DB query.

It will then be manually exported as csv




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625