Professional Web Applications Themes

need help on DISTINCT - ASP Database

Hi ALl, I need some help on DISTINCT in a query I'm trying to run. I have two tables which are linked. This is the query I use: SQL = "SELECT DISTINCT name, category, land, task, nbc_protect, airportable, amphebian, alternative, capacity_fuel, crew, height, length, width, range_max, range_eff, range_cruise, speed_road, terrain_water, speed_terrain, calibre, rate_of_fire, weight, penetration, type_ammo, diameter, radius_casualty, type_fuse, type_grenade, traverse, num_rotor_blades, num_barrels, altitude_max, pressure, charge, max_speed_air, ceiling, datum_invoer, datum_controle, time_controle, weaponkey, ImagePathAndFile " & _ "FROM Weapon INNER JOIN Images ON Weapon.WID = Images.IID" Order = "name" The Table Weapon has a autonumber (WID) which is linked to the ...

  1. #1

    Default need help on DISTINCT

    Hi ALl,

    I need some help on DISTINCT in a query I'm trying to run.
    I have two tables which are linked. This is the query I use:

    SQL = "SELECT DISTINCT name, category, land, task, nbc_protect,
    airportable, amphebian, alternative, capacity_fuel, crew, height,
    length, width, range_max, range_eff, range_cruise, speed_road,
    terrain_water, speed_terrain, calibre, rate_of_fire, weight,
    penetration, type_ammo, diameter, radius_casualty, type_fuse,
    type_grenade, traverse, num_rotor_blades, num_barrels, altitude_max,
    pressure, charge, max_speed_air, ceiling, datum_invoer,
    datum_controle, time_controle, weaponkey, ImagePathAndFile " & _
    "FROM Weapon INNER JOIN Images ON Weapon.WID = Images.IID"
    Order = "name"

    The Table Weapon has a autonumber (WID) which is linked to the IID in
    Images.
    There are several recs in Weapon which have more then one picture
    linked to it.
    The way it is now I see these records several times in the query
    results.

    I want them to show up only once. What do I have to alter here?

    Regards
    Marco
    Krechting Guest

  2. #2

    Default Re: need help on DISTINCT

    So, what do you want, any arbitrary image from the Images table?

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Krechting" <m.krechtingchello.nl> wrote in message
    news:a71c776d.0401111322.36869a13posting.google.c om...
    > Hi ALl,
    >
    > I need some help on DISTINCT in a query I'm trying to run.
    > I have two tables which are linked. This is the query I use:
    >
    > SQL = "SELECT DISTINCT name, category, land, task, nbc_protect,
    > airportable, amphebian, alternative, capacity_fuel, crew, height,
    > length, width, range_max, range_eff, range_cruise, speed_road,
    > terrain_water, speed_terrain, calibre, rate_of_fire, weight,
    > penetration, type_ammo, diameter, radius_casualty, type_fuse,
    > type_grenade, traverse, num_rotor_blades, num_barrels, altitude_max,
    > pressure, charge, max_speed_air, ceiling, datum_invoer,
    > datum_controle, time_controle, weaponkey, ImagePathAndFile " & _
    > "FROM Weapon INNER JOIN Images ON Weapon.WID = Images.IID"
    > Order = "name"
    >
    > The Table Weapon has a autonumber (WID) which is linked to the IID in
    > Images.
    > There are several recs in Weapon which have more then one picture
    > linked to it.
    > The way it is now I see these records several times in the query
    > results.
    >
    > I want them to show up only once. What do I have to alter here?
    >
    > Regards
    > Marco

    Aaron Bertrand [MVP] Guest

Similar Threads

  1. SQL Distinct
    By DDhillon in forum Coldfusion Database Access
    Replies: 8
    Last Post: July 27th, 03:44 AM
  2. Highest Distinct Value
    By mslima in forum Coldfusion Database Access
    Replies: 4
    Last Post: April 19th, 01:42 PM
  3. Replies: 3
    Last Post: April 18th, 12:52 PM
  4. Replies: 0
    Last Post: April 15th, 01:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139