RE: GROUP BY? Urgent help needed with selection list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ah, that's ugly. Non-standard data is a bitch to make work. What i would do then is create a virtual column with a case-when-then construct based on an instring of area (like akron). Have a look at the mysql manual (http://dev.mysql.com/doc/mysql/en/case-statement.html) for the syntax.

Is there anything preventing you from palying with the data and manipulating it on the way into your site? Trying to make the virtual column in to a real column that could provide the geo reference for future queries.

Bastien

From: "Chris Payne" <cjp@xxxxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject: RE:  GROUP BY? Urgent help needed with selection list
Date: Sun, 23 Jan 2005 14:03:53 -0500

Hi there,

The problem is, the database is imported from a huge properties database and
can only be imported in the format from the central database of estate
agents, so I can't reformat it in the tables itself.


Each table has the same fields, but one is for condo's, one is for
residential etc ..... however, the client need to be able to do a search all
tables query, and bring the results up as though you are only search 1
table. I've never searched multiple tables before without a relative ID,
what I need is to search all of them as though it is just searching 1, so I
don't think multiple queries would work, hence why I'm trying to do it all
in a single query.


Chris


if you have kind of geo id number you could use that, failing to have that info, you could re-arrange the data to have Akron - Central, Akron - SE (so that all is in a standard format)

Bastien

>From: "Chris Payne" <cjp@xxxxxxxxxxxxxxxxx>
>To: <php-db@xxxxxxxxxxxxx>
>Subject: GROUP BY? Urgent help needed with selection list
>Date: Sun, 23 Jan 2005 00:46:18 -0500
>
>Hi there everyone,
>
>
>
>I?m using the following code to populate cities from a huge database:
>
>
>
> <select name="fm_city[]" id="fm_city[]" multiple>
>
> <option value=0>Show All</option>
>
> <?
>
>$sqla = "SELECT DISTINCT(Area) FROM MLS_Listings ORDER BY Area";
>
>
>
>$sql_resulta = mysql_query($sqla,$connection)
>
> or die("Couldn't execute query.");
>
>while ($row = mysql_fetch_array($sql_resulta)) {
>
> $Area = $row["Area"];
>
>
>
>?>
>
> <option value="<?=$Area?>">
>
> <?=$Area?>
>
> </option>
>
> <? }; ?>
>
> </select>
>
>
>
>This works great, no problems BUT the client now needs is so the cities are
>grouped, but it?s not so simple. For example, say you have Akron, Akron
>Central etc ?. They need them so that ALL Akrons appear together, the
>problem is, that also includes some which are SE Akron etc ?. So, of course
>that appears further down the list under S. How can I group this way? I
>am
>pretty lost on this.


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux