On Wed, April 20, 2005 5:53 am, Leif Gregory said:
> So joining on four tables isn't considered bad practice?
No, it's great practice.
The only thing to watch for is just how *BIG* will the number of tuples grow?
If you can multiply together the number of rows in all four tables and
come up with
[snip]
Doing a join on four tables is ok? (serious question, not being
facetious).
[/snip]
Yes, it is OK. Make sure that you have the tables properly indexed and
you'll have no problems.
[snip]
R> By definition, in SQL, if you don't specify a sort order (or in
R> this case a second order) then th
> R> Just build a JOIN query and do one query.
> Doing a join on four tables is ok? (serious question, not being
> facetious).
Yes. I've built a query before (for reporting purposes) that join
15 tables... Just make sure the tables are indexed properly.
thnx,
Chris
--
PHP General Mailing List
Hello Chris,
Tuesday, April 19, 2005, 1:23:53 PM, you wrote:
C> Firstly, what DB are you using?
MySQL.
C> SELECT
C> course.name,
C> location.name,
C> instructor.name
C> FROM
C> course
C> INNER JOIN location ON location.id = course.locationID
C> INNER JOIN instructor ON instructor.id = co
Hello Richard,
Tuesday, April 19, 2005, 9:12:14 PM, you wrote:
R> Just build a JOIN query and do one query.
Doing a join on four tables is ok? (serious question, not being
facetious).
R> No, it is *NOT* sorting on the ID number.
I can definitely say it is sorting on locationID, categoryID,
or i
Hello Kim,
Tuesday, April 19, 2005, 6:44:58 PM, you wrote:
K> If you are still looking for "tips" and want to get
K> complicated/fancy, I have seen columns used called sort_order more
K> than a few times. This should not be too hard to maintain for
K> things like a few buildings, etc., where the l
[snip]
Sorry that this has degenerated into a MySQL question rather than PHP.
I was originally looking for how people handled it in PHP.
---
Actually it didn't degenerate, it was a SQL question all along. Unless
you had a desire to build sortable arrays in PHP this type of sort
should always be don
[snip]
SELECT *
FROM Course
ORDER BY locationID ASC
Now the ORDER BY can be any one of five things based on the variable
passed by the hyperlink for the column they clicked on (location,
course, date, category, and instructor
[/snip]
If you had a JOIN to the location table you could order by the
> The actual SELECT statement is as follows:
> $sqlCourses="SELECT * FROM " . $tbl_courses . " WHERE courseDate > '" .
date("Y-m-d") . "' ORDER BY " . $orderBy . " ASC";
> the $orderBy variable is set via $_GET['orderBy'] which is sent by the
> table headers as below:
I'm curious why you aren't jo
Hello Jay,
Tuesday, April 19, 2005, 1:28:25 PM, you wrote:
J> Normalization has no effect on sort order where any DB is concerned.
J> Sort order is determined in the sort clause in the query. So if you want
J> to sort by location and you are using MySQL your ORDER BY clause should
J> be location.
On Tue, April 19, 2005 12:10 pm, Leif Gregory said:
> I've been wrestling with this one for a bit and wanted to see if
> anyone had a nice magic bullet (yeah right) to do this.
Yes.
> Now, I want to display all the courses and have the names instead of
> id numbers show up, so I'd select from Cou
Greetings,
If you are still looking for "tips" and want to get complicated/fancy,
I have seen columns used called sort_order more than a few times.
This should not be too hard to maintain for things like a few
buildings, etc., where the lookup table does not change much over
time. You would th
[snip]
I can do that, but is there a better way? How do you all handle
dynamic sorting of normalized DBs?
[/snip]
Normalization has no effect on sort order where any DB is concerned.
Sort order is determined in the sort clause in the query. So if you want
to sort by location and you are using MySQ
> I can do that, but is there a better way? How do you all handle
> dynamic sorting of normalized DBs?
Firstly, what DB are you using?
Secondly, just select and sort on the columns. An example query
would be:
SELECT
course.name,
location.name,
instructor.name
FROM
course
INNER JOIN locat
Hello php-general,
I've been wrestling with this one for a bit and wanted to see if
anyone had a nice magic bullet (yeah right) to do this.
Let's just keep it simple (my DB is a bit more complex).
We have a DB called Courses with three tables.
Instructors -
id
name
Locations
id
name
C
15 matches
Mail list logo