• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

displaying some query data

atomic3

Limp Gawd
Joined
Dec 16, 2003
Messages
140
hey all,

i'm developing an internal intranet application for a company this summer and need some help. basically i am stuck with displaying some data on one of my pages.

First off, I am using ColdFusion with an Oracle backend. I am trying to display data from two tables that have a 1 - Many relationship. Just For example, 1 city can have Many zipcodes. So lets say i am trying to output all of the cities and their zipcodes on a page. How my page works now, is it will display each city name and one zipcode as one row, and do this for each zipcode. What i want is for it to display the city name once, and all the zipcodes that go alone with it in a group.

like this.

CityName ZipCode
----------------------------------------
Chicago 60655
60611
60422

Dekalb 60115

instead of this

CityName ZipCode
----------------------------------------
Chicago 60655
Chicago 60611
Chicago 60422
Dekalb 60115

can anyone help me with the logic behind this? i dont expect anyone to know the coldfusion syntax for my problem, i mean i would appreciate it, but if you can just help with the logic that would be a huge help.
 
Quick question for you. You say you're using Oracle so does that mean that you're basically using SQL?

The reason I ask is because it seems to me you may be able to set up your query with a "group by" clause. It's been a little while since I've done this kind of thing with SQL and I'm trying to get back into it actually but I used to have to do ad-hoc sql reports on Tandem systems for various companies I worked for in the past. If I remember correctly when I used a "group by" clause it would do pretty much what you're wanting, print the city once (which is what you would group by) and then list all of the zipcodes.
 
yeah i am using SQL. i will try that group by thing today! great idea...
 
Back
Top