Ask a Question related to ASP Database, Design and Development.
-
Krechting #1
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
-
SUM (DISTINCT) INNER JOIN
I have two tables recording the sales transactions with purchase_id the common key Table 1 (Recording total amounts and customer info) ... -
SQL Distinct
I want to select distinct value from one field of the table and select rest of the corresponding fields accordingly. I have a table that has fields:... -
Using DISTINCT for some but not others in 1 query
I feel really stupid. That doesn't happen too often.. but I feel really stupid. SQL is completely kicking my face in right now. So to get... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Following is my stored procedure. If I take the DISTINCT out then everything works fine. BUT I need the distinct because it returns duplicate... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id, -
Aaron Bertrand [MVP] #2
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.krechting@chello.nl> wrote in message
news:a71c776d.0401111322.36869a13@posting.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



Reply With Quote

