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?

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, 6 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, 6 Months ago Karma: 760
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, 6 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, 6 Months ago Karma: 760
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, 6 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, 6 Months ago Karma: 760
Try S.published = 1

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