|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||||
|
|||||
|
Complex query and join
I have a table of subjects that a system user can view that is set up already. I have added another column to this.
The table is broken down with php variables, and the structure is set up in an inc file. So there are $table, $fields[], $select_options, $where_clause, $order_by_clause variables. The data, or how to display it, is done with an external processing function, calling each field and echoing either the data or a non breaking space. It uses switch case: to do this. This is how the query is looking normally when it all goes together nicely: php Code:
This works, and displays a nice table, the first column, the div is displayed as a link to view more information on the 'subject' of the query. Now came my problem. I added the final column. Which comes from a third table. (This column ideally would display how many books each subject had.) The table it comes from however, has also got a div field, and a control field. And both of these need to be checked for the query to display proper results. I have tried a join clause and i also tried simply adding an additional field variable: Ideally though, i'd like to use the Anyways... I'm trying not to confuse you anymore then I am. What is happening, is if i do it with the control, i am getting too many rows of the same div, and if i add something to the where clause, it doesn't display them if they are not in the tb3. I am sorry this sounds so confusing, perhaps it is my mind state. Basically, I want information from 3 tables. Two tables contain the same field names, I want the div fields to all match up. However even if there is no div in the third table, the information should still be displayed. Hope someone can make sense of this. :S |
|
#2
|
|||
|
|||
|
RE: Complex query and join
Too confusing?
Well that's ok i got it. I kept the join by, and added a group by. Now i just have to figure out the count part. thanks anyways! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Complex query and join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|