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 inner join in sql server joins?
What is cursors? And what are the different types of cursor?
Explain primary key, foreign key and unique key?
How to bind a view to the schema of the underlying tables?
Do you know exporting and importing utility?
What is entity data services?
What is transaction server distributed transaction?
Explain what is lock escalation and what is its purpose?
What is the difference between the application object and session object?
What do you mean by a dependent functionality in a build?
What is difference between index and primary key?
How get current date in SQL server 2000
4 Answers Cap Gemini, Polaris,
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)