Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / November 2007



Tip: Looking for answers? Try searching our database.

stuck at query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nightwolf666 - 25 Nov 2007 17:42 GMT
hi, i am doing a query in which i am deriving the results from the database as:

SELECT properties_details.property_unique_name, cityname as dCity,
    Subdivion_name as sub_name,  
    property_type_name as ptname  
    FROM properties_details
    INNER JOIN cities ON
    cities.cities_id =  properties_details.city_id
    INNER JOIN cities_subdivision ON
    cities_subdivision.sub_id = properties_details.sub_id
    INNER JOIN properties_types ON properties_types.ptype_id =
properties_details.ptype_id
    WHERE city_id =
  <cfqueryparam cfsqltype="cf_sql_integer" value="#url.detailsID#">

ok now when i reach the page where the query is executed,

what i need is split between the two types of properties, residential and
commercial, u will see the sub_id in the above query..

so on the page i do it loike this:

<cfif all.sub_id EQ 1>
         <cfoutput query="all">
         <tr>
             <td>#currentrow#</td>
            <td>#property_unique_name#</td>
            <td>#dcity#</td>
            <td>#ptname#</td>
            </tr>
            </cfoutput>
            <cfelse>
            <tr>
            <td colspan="4">No Residential property</td>
            </tr>
            </cfif>

the above should show the properties of residential in residential box and
commercial in commercial box but somehow i don't know it is showing all the
properties in the residential status also whose sub_id is not residential..

plz see this why i am getting this errronous thing,

i get no error for this:
JR "Bob" Dobbs - 25 Nov 2007 18:49 GMT
Consider using the 'group' attribute of the cfoutput tag to group your output
by property_type_name, you will also need to order by property_type_name on
your query.


http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.ht
ml#1101659
nightwolf666 - 26 Nov 2007 03:43 GMT
using the group caused some change in the query but i applies several ways to
change the order by clause to one to another

but it keep coming up with 121, or 12 or 1211, the 2 stans for "Commercial"
never seems to be going, i don't know what i am experiencing, behaving in very
unusal manner.

i also forgot one thing..

the sub_id of cities_subdivision is also the foreign key of table
properties_types table and the keys of properties_types, cities,
cities_subdivision are foreign keys of properties table
Dan Bracuk - 26 Nov 2007 04:07 GMT
[q][i]Originally posted by: [b][b]nightwolf666[/b][/b][/i]
using the group caused some change in the query but i applies several ways to
change the order by clause to one to another

but it keep coming up with 121, or 12 or 1211, the 2 stans for "Commercial"
never seems to be going, i don't know what i am experiencing, behaving in very
unusal manner.

i also forgot one thing..

the sub_id of cities_subdivision is also the foreign key of table
properties_types table and the keys of properties_types, cities,
cities_subdivision are foreign keys of properties table[/q]
He said the group attribute of cfoutput.  He did not say a group by clause in
your query.

By the way, when you are using a group attribute, you usually have to use an
order by clause on that field in your query.
nightwolf666 - 26 Nov 2007 06:30 GMT
yes, i did group the cfoutput not the query but the query is producing unusual
results, what the query is exactly doing is:

outputing all the results under residential and if the property is under
residential and have same property type of "PLOTS" the it is showing just one
record not the both..

using the same as provided by:

Consider using the 'group' attribute of the cfoutput tag to group your output
by property_type_name or sub_id (whatever contains 'commercial' or
'residential' as data), you will also need to order by property_type_name on
your query.
Azadi - 26 Nov 2007 06:54 GMT
post your query sql

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.