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


Recent Events
  • 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.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


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?

Help needed to create query
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Help needed to create query
#49310
Help needed to create query 10 Years, 2 Months ago Karma: 0
I have two tables in the database
Table1:Subsribers
name, plan_id

Table2:Plan
plan_id, plan

I should like to create a table showing the records, as follows,

name plan

I can not join the tables. Would you please to help me with the query? I am new in SQL queries.
The administrator has disabled public write access.
 
#49311
Re:Help needed to create query 10 Years, 2 Months ago Karma: 748
Hello,

Use the following query:

Code:


SELECT
 S.name,
 P.plan
FROM
 Subscribers S INNER JOIN Plan P
   ON S.plan_id = P.plan_id



Regards,
ARI Soft
The administrator has disabled public write access.
 
#49320
Re:Help needed to create query 10 Years, 2 Months ago Karma: 0
Thank you for the prompt answer. Here is my complete query, but I did something wrong, when I applied the sample.

SELECT S.membership_id, organization, first_name, last_name, country, date(created_date), P.title
FROM jos_osmembership_subscribers, S
WHERE published=1
INNER JOIN jos_osmembership_plans P ON S.plan_id=P.plan_id

What I did wrong?
The administrator has disabled public write access.
 
#49321
Re:Help needed to create query 10 Years, 2 Months ago Karma: 748
Try the following:

Code:


SELECT 
   S.membership_id, 
   organization, 
   first_name, 
   last_name, 
   country, 
   date(created_date), 
   P.title
FROM 
 jos_osmembership_subscribers S INNER JOIN jos_osmembership_plans P 
   ON S.plan_id=P.plan_id
WHERE 
   published=1



Regards,
ARI Soft
The administrator has disabled public write access.
 
#49323
Re:Help needed to create query 10 Years, 2 Months ago Karma: 0
Thank you. It is working fine, but without the WHERE published=1
When it is in the query it returns with empty record, however there is records in the jos_osmembership_subscribers table, where the published value is 1. (No typo error.) The WHERE is working fine without the JOIN function.
The administrator has disabled public write access.
 
#49324
Re:Help needed to create query 10 Years, 2 Months ago Karma: 748
Try S.published = 1

Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 12