Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE
#30610
MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE 12 Years, 3 Months ago Karma: 0
I have 5 tables from which i need to create one table, here are the 5 tables and their pertinent fields only. I color coded them to indicate how they relate to one another:

jml_jvotesystem_votes
user_id = jml_jvotesystem_users : id
answer_id = jml_jvotesystem_answers : id

jml_jvotesystem_users
id = jml_jvotesystem_votes : user_id
jid = jml_users : id

jml_jvotesystem_answers
id = jml_jvotesystem_votes : answer_id
• answer

jml_users
id = jml_jvotesystem_users : jid
• name
• email

jml_comprofiler
id
user_id
• cb_city
• cb_instrumentsplayed
• cb_contact

The end result is I need list of all the votes from the first table, jml_jvotesystem_votes, and the table should have these fields shown by” table name: field name”

1) jml_jvotesystem_answers : answer
2) jml_users : name
3) jml_users : email
4) jml_comprofiler: city
5) jml_comprofiler : cb_instrumentsplayed
6) jml_comprofiler : cb_contact

Please provide the SQL Query I should use to get this to display.

I deeply appreciate the help,

Gorden
The administrator has disabled public write access.
 
#30615
Re:MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE 12 Years, 3 Months ago Karma: 760
Hello,

Try to use the next SQL query:

Code:


SELECT
 A.answer,
 U.name,
 U.email,
 CP.cb_city AS city,
 CP.cb_instrumentsplayed AS instrumentsplayed,
 CP.cb_contact AS contact
FROM
 #__jvotesystem_votes V INNER JOIN #__jvotesystem_users VU
   ON V.user_id = VU.id
 INNER JOIN #__jvotesystem_answers A
   ON V.answer_id = A.id
 INNER JOIN #__users U
   ON VU.jid = U.id
 INNER JOIN #__jml_comprofiler CP
   ON U.id = CP.user_id



Regards,
ARI Soft
The administrator has disabled public write access.
 
#30648
Re:MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE 12 Years, 3 Months ago Karma: 0
Thanks, but I can not get it to work. I get a Syntax error on line 10 but I can;t see anything wrong, though I think there was one error as highlighted below. I will email my phpMyAdmin Access to you, then you can quickly test it out.

Do I need a Where statement? I want to show all results.

===============================================================

SELECT
A.answer,
U.name,
U.email,
CP.cb_city AS city,
CP.cb_instrumentsplayed AS instrumentsplayed,
CP.cb_contact AS contact
FROM
#__jvotesystem_votes V INNER JOIN #__jvotesystem_users VU
ON V.user_id = VU.id
INNER JOIN #__jvotesystem_answers A
ON V.answer_id = A.id
INNER JOIN #__users U
ON VU.jid = U.id
INNER JOIN #__jml_comprofiler CP
ON U.id = CP.user_id
The administrator has disabled public write access.
 
#30653
Re:MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE 12 Years, 3 Months ago Karma: 760
Use the following query:

SELECT
A.answer,
U.name,
U.email,
CP.cb_city AS city,
CP.cb_instrumentsplayed AS instrumentsplayed,
CP.cb_contact AS contact
FROM
#__jvotesystem_votes V INNER JOIN #__jvotesystem_users VU
ON V.user_id = VU.id
INNER JOIN #__jvotesystem_answers A
ON V.answer_id = A.id
INNER JOIN #__users U
ON VU.jid = U.id
INNER JOIN #__comprofiler CP
ON U.id = CP.user_id

Regards,
ARI Soft
The administrator has disabled public write access.
 
#30665
Re:MERGE DATA FROM 5 SQL TABLES INTO 1 ARI DATA TABLE 12 Years, 3 Months ago Karma: 0
THANK YOU, THANK YOU, THANK YOU, WORKS BEAUTIFULLY.
The administrator has disabled public write access.
 
Go to topPage: 1