If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Create view of 100 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-07, 00:31
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Create view of 100 tables

I am curious if creating a view with over 100 fields in about 45 tables is an *acceptable* practice or if there is a better way to do this.

I am programming a php frontend to a mysql db and need to create the select statement. What I have are a lot of fields to be populated into a template. This template has a header to make the documant more readable then the corasponding data fields below it. The header is not stored in the db, only the fields. So I may have the following:

Code:
customer (Header)
name
address
city
state

hobbies (Header)
basketball
football
etc..
These fields are scattered all throughout the db and I will need to join them all together to get what I need.

As I am thinking about this, it doesn't seem right. There has to be another way, or is this common practice?

I am not that proficient with php and I know I could probably create a class to handle multiple views but right now that is not an option for me.

Last edited by Frunkie; 06-03-07 at 00:36.
Reply With Quote
  #2 (permalink)  
Old 06-03-07, 07:03
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by fjm1967
I am curious if creating a view with over 100 fields in about 45 tables is an *acceptable* practice or if there is a better way to do this.
if the view is necessary, then it's acceptable

however, i doubt very much that you will be able to write an actual query that spans 45 tables

that is how you develop a view -- develop and test the underlying query first, make sure it is producing the correct results, then slap CREATE VIEW AS in front of it
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 06-04-07, 02:52
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Its necessary but you are correct, not possible. I tried every which way and I just can't get it working. I am going to have to find another alternative using another php class.

Thanks for the pointer on the creation of the view; great advice. Now I know what I am up against.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On