sairam

sairam

  • NA
  • 69
  • 0

SQL QUERY CHALLENGING

May 5 2009 1:22 PM

I have two tables. table1 and table2.

table 1 has the following fields

CNO[Primarykey],Cname,Question,Date

table 2 has follwoing fields

CNO[Foreign key],SOQ.

when i write query select SOQ from table 2 where CNO = 1336

i get output as

101

102

103

 

for a different CNO the o/p varies. the o/p is nopt always 3 rows

. My question is

I have a datagridview in windows forms. the header of that grid should be as  follows

CNO     Cname    Question    101    102     103

So the output of table 2 should be included as  header for datagrid. how should i write the query

Dont worry about the data in the cells below 101 102 103. they will be blank for ever.

 

Thanks


Answers (4)