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 |
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
What is the difference between DTS and SSIS?
how you can list all the tables in a database?
how you can get the list of largest tables in a database? : Sql server administration
Can you explain what is sql server english query?
How to insert new line characters into strings?
Tell me about normalization in DBMS.
Do you know what is bit data type and whats the information that can be stored inside a bit column?
can any body tell me how to know the password of current user in sql server
Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?
What is Primary key and foreign key? Give an example
Explain alternate key, candidate key and composite key in sql 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)