CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Tricky SQL question

Print topic Send  topic

Author Message
Paul
Posted: 03/21/2002, 4:01 AM

I have used the code below to display records from a table (location) and then attach to each record a marker to say what divisions can be found at that location based on another table (division_location) i.e. Northamption Location contains Industrial and Office Personnel divisions:

SELECT location.*, d1.division_id EDU, d2.division_id IND, d3.division_id OP, d4.division_id SA, d5.division_id TE, d6.division_id EX, d7.division_id HE, d8.division_id CO, d9.division_id AC, d10.division_id CC
FROM location
left outer join division_location d1 on location.location_id = d1.location_id and
d1.division_id = 2
left outer join division_location d2 on location.location_id = d2.location_id and
d2.division_id = 3
left outer join division_location d3 on location.location_id = d3.location_id and
d3.division_id = 4
left outer join division_location d4 on location.location_id = d4.location_id and
d4.division_id = 5
left outer join division_location d5 on location.location_id = d5.location_id and
d5.division_id = 6
left outer join division_location d6 on location.location_id = d6.location_id and
d6.division_id = 7
left outer join division_location d7 on location.location_id = d7.location_id and
d7.division_id = 8
left outer join division_location d8 on location.location_id = d8.location_id and
d8.division_id = 9
left outer join division_location d9 on location.location_id = d9.location_id and
d9.division_id = 10
left outer join division_location d10 on location.location_id = d10.location_id and
d10.division_id = 13
WHERE location.location_country = " & GetCountry & "
ORDER BY location.location

This works fine, but what i would like is for visitors to be able to select a division (1-13) and then the grid would display only records containing that division?

Tricky i know, but any ideas?
Jack
Posted: 03/21/2002, 4:44 AM

Paul,
try to create search form where customers will select the division. then add Input parameter division_id to grid form.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.