i have account table which consists of account name,card no
and card no consists 16 digits now i want to retrieve the
data if card no starts from 4 then it should print visa and
if it starts from 5 then it should print master so plse help
me to write simple query with out store procs .
Answers were Sorted based on User's Feedback
Answer / rajesh bhawsar
select name,
(case left(cardno,1)
when '4' then 'visa'
when '5' then 'master'
end) as result from account
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / rahul
hi every one.
select name,
case
when card_no like'4%' then 'visa'
when card_no like'5%' then 'master'
end result from account;
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / kiranu
Hi every one
select name, cardno(case substring(cardno,1,1)when '4' then
'Visa' when '5' then 'Master' end) as Result from account;
| Is This Answer Correct ? | 1 Yes | 0 No |
What is postgresql server?
Explain the architecture of ms sql reporting service?
What is the latest version of microsoft sql server?
Explain the creation and execution of a user-defined function in the sql server?
What does sql server mean?
What is difference between TRUNCATE and DELETE statement
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
How can u convert the Date to String?
What is transcation?Plz give One example?
What happens if time-only values are provided as date and time literals?
Why should one not prefix user stored procedures with ‘sp_’?
Describe how to use linked server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)