Getting Records randomly from tables [modified]
-
hi all, i have two tables with data.like this
Table 1 Table 2
Name Age Sex Adress Phone no city
Basha 24 m 1 st street 2124 india
Peter 25 m 2nd street 24589 USAout put should be like this:
m1 m2 m3
basha 24 m
1 st street 2124 india
peter 25 m
2 nd street 24589 USAHow can i get the out like this what can i do... Thanks & Regards, S.Inayat Basha
modified on Saturday, March 27, 2010 4:11 PM
-
hi all, i have two tables with data.like this
Table 1 Table 2
Name Age Sex Adress Phone no city
Basha 24 m 1 st street 2124 india
Peter 25 m 2nd street 24589 USAout put should be like this:
m1 m2 m3
basha 24 m
1 st street 2124 india
peter 25 m
2 nd street 24589 USAHow can i get the out like this what can i do... Thanks & Regards, S.Inayat Basha
modified on Saturday, March 27, 2010 4:11 PM
I am not sure this can easily be done on the server side. I may be inclined to do the process on the client:
-- Server query
SELECT Name, Age, Sex, Address, Phone, City
FROM Person p
JOIN Address a
ON a.ID = p.ID
ORDER BY p.Name' After retreiving the data into a DataTable (dt)
Dim count as Integer = 0
Dim arr(( (dt.Rows.Count) * 2) - 1), 2) As String
For Each dr as DataRow In dt
arr( count, 0) = dr("Name").ToString
arr( count, 1) = dr("Age").ToString
arr( count, 2) = dr("Sex").ToString
count += 1
arr( count, 0) = dr("Address").ToString
arr( count, 1) = dr("Phone").ToString
arr( count, 2) = dr("City").ToString
count += 1
NextI don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife
-
hi all, i have two tables with data.like this
Table 1 Table 2
Name Age Sex Adress Phone no city
Basha 24 m 1 st street 2124 india
Peter 25 m 2nd street 24589 USAout put should be like this:
m1 m2 m3
basha 24 m
1 st street 2124 india
peter 25 m
2 nd street 24589 USAHow can i get the out like this what can i do... Thanks & Regards, S.Inayat Basha
modified on Saturday, March 27, 2010 4:11 PM
Why, the only reason I can think of for this is to service a presentation requirement, that is a report, output or a form requirement. The relevant word is PRESENTATION, do this type of formatting at the correct place, not in the database, as has been suggested. This is not a suggestion it is a general rule, a database is for the data, not pissing about with formatting and layout.
Never underestimate the power of human stupidity RAH