|
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
How do I use "order by" for this?
Hi, all...Rick Faircloth 05/17/08 08:15 P >Is there a way to do this in the code or should I just addWill Tomlinson 05/17/08 08:23 P I was until last week. :o)Rick Faircloth 05/17/08 08:28 P Well... I can't figure out how to use the "order_by" columnRick Faircloth 05/18/08 02:14 P >Well... I can't figure out how to use the "order_by" columnWill Tomlinson 05/18/08 07:37 P Thanks, Will...Rick Faircloth 05/18/08 08:03 P Hi, all... I need to have my client's properties show up first in a list with other companies. How would I use "order by" or "group", etc., to get their properties first? It can't be alphabetically or numerically. Their name is not the first alphabetically. And even if it were, another company could be added at any time to the data whose name might precede theirs. Is there a way to do this in the code or should I just add an "order_by" field to the db (MySQL 5) and just put 1 in their field and leave everyone else's field null? (This sounds reasonable and simple enough) Thoughts? Thanks, Rick >Is there a way to do this in the code or should I just add >an "order_by" field to the db (MySQL 5) and just put 1 >in their field and leave everyone else's field null? (This >sounds reasonable and simple enough) > >Thoughts? Dude, I've hadda few long islands tnight, but I'd use an orderby field like you say. Quick'n'easy ('n'Dirty) (Figured you were probably on MySQL 2) :) Will I was until last week. :o) Thanks, Will! ----- Excess quoted text cut - see Original Post for more ----- Well... I can't figure out how to use the "order_by" column I've put into each real estate office table. Let's say (to make this simpler) that I've got six tables. 1 - hmls_offices 2 - hmls_lots 3 - hmls_homes 4 - smlc_offices 5 - smlc_lots 6 - smlc_homes The hmls_offices and smlc_offices tables both have a display_order column for each office. For my client's display_order column, I give the first office a '1' and the second office an order of '2' and the remaining offices are null. How would I use that column with these different select statements? (These are shortened to make this simple to work with...) select hl.property_id as prop_id from hmls_lots hl union all select sl.property_id as prop_id from smlc_lots sl union all select hh.property_id as prop_id from hmls_homes hh union all select sh.property_id as prop_id from smlc_homes sh order by "the display_order number for each office" ??? Would it be better to run a first query to get the office_id's, order that by display_order, then loop that query with the "get_properties" query inside? (I tried a version of that and my "get_properties" query, which was running in about 2 seconds for 7,000 properties, suddenly bogged down so badly the browser timed out...) I'm beginning to think that I might be better off just combining the data from the two data providers into the same tables, instead of separating them by property type as they do, and keeping the data separate by the data provider, as I have so far. Thoughts, anyone? Rick ----- Excess quoted text cut - see Original Post for more ----- Quick'n'easy ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- It looks like you don't have the tables right. If it were me, I'd have a listingtypes table. Types are hmls, smlc Then you can use an offices table, linking it to the types table. Then do the same with lots and homes. my .02 at first glance. Will Thanks, Will... I've decided to just merge all the property data from the two databases into one massive property table. I'm going to incorporate a "source field", as well, with the data for that field specifying the data vendor. I need that if for no other reason because each vendor supplies much data that is different from the other and I have to adjust the display depending on the vendor. :oP While merging the databases is huge headache in the beginning, I'm hoping it will simplify all manner of queries, especially the "search by many various parameters" query, and perhaps speed up the queries, too. Utilizing data from two different vendors with little consistency between the schemas has been the biggest pain in the rear I've come across. I going to charge $50,000+ the next time someone calls on me to do merge two vendors' data into a single active database. And to have to do it daily, to boot! Once I get it all automated with scheduled tasks it won't be a problem, hopefully. But, this has taken waaaaaay too much time! I should have contracted this project by the hour... Rick ----- Excess quoted text cut - see Original Post for more ----- homes. ----- Excess quoted text cut - see Original Post for more -----
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||