The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Creating a view from multiple tables
tudsy
post Aug 5 2018, 11:32 PM
Post #1


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



Hi

I have 4 tables, CustomersArt,Customers,subscribers and emailcomm.

My question is, how do i create a view from these 4 tables with the column email ?

I have done a view from one table (see below):

$query = "CREATE VIEW ecovib2d AS SELECT email FROM CustomersArt";


Any help will be appreciated.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
tudsy
post Sep 4 2018, 11:49 PM
Post #2


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



Hi

Thanks for that.

I renamed the column names with different names.

I have now decided to go with a simple select statement.


$query ="SELECT

Customers.Customersitemid,Customers.email,Customers.name,Customers.Price,Customers.terms,Customers.Age,Customers.Date,Customers.Softbought,CustomersArt.CustomersArtitemid,CustomersArt.nameof,CustomersArt.Priceofart,CustomersArt.Dateof,CustomersArt.termsof,CustomersArt.Ageof,CustomersArt.graphic,CustomersArt.emailadd

FROM Customers JOIN CustomersArt ON Customers.Customersitemid = CustomersArt.CustomersArtitemid";


But its not working. I cant see what is the problem.

Any help will be appreciated. Thanks.


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 5 2018, 12:11 AM
Post #3


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



QUOTE(tudsy @ Sep 4 2018, 11:49 PM) *

$query ="SELECT Customers.Customersitemid, Customers.email, Customers.name, Customers.Price, Customers.terms, Customers.Age, Customers.Date, Customers.Softbought, CustomersArt.CustomersArtitemid, CustomersArt.nameof, CustomersArt.Priceofart ,CustomersArt.Dateof, CustomersArt.termsof, CustomersArt.Ageof, CustomersArt.graphic, CustomersArt.emailadd
FROM Customers JOIN CustomersArt ON Customers.Customersitemid = CustomersArt.CustomersArtitemid";
So, you're telling me that table 'Customers' has a column named 'Customersitemid' and table 'CustomersArt' has a column named 'CustomersArtitemid'?
Or, does table 'Customers' have a column named 'Itemid' and does table 'CustomersArt' have a column named 'Itemid'?

Which is correct?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
tudsy   Creating a view from multiple tables   Aug 5 2018, 11:32 PM
CharlesEF   You need to look in to INNER JOIN or OUTER JOIN to...   Aug 6 2018, 01:42 PM
tudsy   You need to look in to INNER JOIN or OUTER JOIN t...   Aug 6 2018, 01:57 PM
CharlesEF   You still don't tell me what columns you want ...   Aug 6 2018, 02:07 PM
tudsy   You still don't tell me what columns you want...   Aug 6 2018, 11:30 PM
tudsy   Hi A solution: “CREATE VIEW ecovib2d AS SELECT...   Aug 10 2018, 03:55 AM
CharlesEF   No. You're not joining any tables. Here is a...   Aug 10 2018, 12:13 PM
CharlesEF   You should start by joining just 1 table. I haven...   Aug 10 2018, 03:31 PM
CharlesEF   Ok, here is a hint. Since you never said which co...   Aug 11 2018, 12:21 PM
tudsy   Ok, here is a hint. Since you never said which c...   Aug 11 2018, 10:38 PM
CharlesEF   I don't think so, you need to change the ON pa...   Aug 12 2018, 12:16 AM
tudsy   I don't think so, you need to change the ON p...   Aug 14 2018, 08:21 PM
tudsy   I don't think so, you need to change the ON ...   Aug 14 2018, 09:53 PM
CharlesEF   Just in case, your error is here: WHERE email =...   Aug 15 2018, 01:06 AM
CharlesEF   Correction: Since the entire query should be enclo...   Aug 15 2018, 12:12 PM
tudsy   Hi I have another problem. Here is a query: ...   Aug 15 2018, 11:27 PM
CharlesEF   I don't see anything wrong, as far as syntax. ...   Aug 16 2018, 12:13 AM
tudsy   I don't see anything wrong, as far as syntax....   Aug 20 2018, 08:11 PM
CharlesEF   I don't see anything wrong with the syntax. A...   Aug 21 2018, 02:43 PM
tudsy   I don't see anything wrong with the syntax. ...   Aug 26 2018, 12:48 AM
CharlesEF   $query = "CREATE VIEW ecovib2d AS ...   Aug 26 2018, 02:39 AM
tudsy   Hi Thanks for that. I renamed the column names w...   Sep 4 2018, 11:49 PM
CharlesEF   $query ="SELECT Customers.Customersitem...   Sep 5 2018, 12:11 AM
tudsy   $query ="SELECT Customers.Customersite...   Sep 5 2018, 12:15 AM
CharlesEF   Create a new PHP script and place this code in it....   Sep 6 2018, 12:24 AM
tudsy   Create a new PHP script and place this code in it...   Sep 6 2018, 09:54 PM
CharlesEF   That tells me the script did run but returned no r...   Sep 6 2018, 10:26 PM
tudsy   That tells me the script did run but returned no ...   Sep 6 2018, 10:59 PM
tudsy   That tells me the script did run but returned no ...   Sep 6 2018, 10:59 PM
CharlesEF   That doesn't help much. Customers contains no...   Sep 7 2018, 12:40 AM
tudsy   That doesn't help much. Customers contains n...   Sep 7 2018, 01:05 AM
CharlesEF   I want the visitor to look at his/her data (the w...   Sep 7 2018, 01:48 AM
CharlesEF   I want to add that if you are happy with your data...   Sep 7 2018, 05:40 PM
tudsy   I want to add that if you are happy with your dat...   Sep 7 2018, 08:50 PM
CharlesEF   Results: Viewing your data from ECOVIB2DS databas...   Sep 7 2018, 09:08 PM
tudsy   Results: Viewing your data from ECOVIB2DS databa...   Sep 7 2018, 10:38 PM
tudsy   [quote name='CharlesEF' post='136182' date='Sep 8...   Sep 7 2018, 10:47 PM
CharlesEF   Telling me about an error but now showing the quer...   Sep 7 2018, 11:46 PM


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 05:31 PM