Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Getting Records randomly from tables [modified]

Getting Records randomly from tables [modified]

Scheduled Pinned Locked Moved Database
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    inayat basha
    wrote on last edited by
    #1

    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 USA

    out put should be like this:

    m1 m2 m3

    basha 24 m
    1 st street 2124 india
    peter 25 m
    2 nd street 24589 USA

    How 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

    A M 2 Replies Last reply
    0
    • I inayat basha

      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 USA

      out put should be like this:

      m1 m2 m3

      basha 24 m
      1 st street 2124 india
      peter 25 m
      2 nd street 24589 USA

      How 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

      A Offline
      A Offline
      Andy_L_J
      wrote on last edited by
      #2

      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
      Next

      I don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife

      1 Reply Last reply
      0
      • I inayat basha

        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 USA

        out put should be like this:

        m1 m2 m3

        basha 24 m
        1 st street 2124 india
        peter 25 m
        2 nd street 24589 USA

        How 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

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups