One table Test with single column. These are the values in
the table
a
b
c
d
e
f
g
h
I need a query (without using any variable) with output as -
a b c
d e f
g h
Answer / gopi muluka
Check this
DECLARE @Character TABLE
(
Ch VARCHAR(50)
)
INSERT INTO @Character
SELECT 'a' UNION
SELECT 'b' UNION
SELECT 'c' UNION
SELECT 'd' UNION
SELECT 'e' UNION
SELECT 'f' UNION
SELECT 'g' UNION
SELECT 'h' UNION
SELECT 'i' UNION
SELECT 'j' UNION
SELECT 'k' UNION
SELECT NULL
SELECT A.Ch,B.Ch,MAX(C.Ch)
FROM @Character A
CROSS JOIN @Character B
CROSS JOIN @Character C
WHERE ASCII(A.Ch)+1=ASCII(B.Ch) AND ASCII(A.Ch)% 3=1
AND ASCII(B.Ch)+1=ISNULL(ASCII(C.Ch),ASCII(B.Ch)+1) AND
ASCII(B.Ch)% 3=2
GROUP BY A.Ch,B.Ch
| Is This Answer Correct ? | 1 Yes | 0 No |
Explain what is the difference between union and union all?
What is the architecture of ms sql reporting service?
What are the difficulties faced in cube development? : sql server analysis services, ssas
what is normalization? Explain different levels of normalization? : Sql server database administration
What is logshipping and its purpose?
Explain raiserror in sql server?
Explain filtered indexes?
What is de-normalization and when do you do it?
How do you implement session management in SQL Server mode?
Questions regarding Raiseerror?
explain different types of jions with examples briefly?
2 Answers Accenture, Excellence, Zensar,
hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail
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)