473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INNER JOIN Problem

exoskeleton
104 New Member
hi dear experts im here once again...i have a problem on showing the result when im using inner join...here's my code..

[PHP]
$sql_trans_pro_ tbl="SELECT transaction_tbl .date_subscribe ,transaction_tb l.date_expire".
",product_tbl.p ro_id,product_t bl.pro_des FROM transaction_tbl INNER JOIN".
" product_tbl ON transaction_tbl .pro_id=product _tbl.pro_id WHERE".
" transaction_tbl .account_name=' $forder_name'";
$update_trans_p ro_tbl=pg_exec( $sql_trans_pro_ tbl);

while($fld=pg_f etch_array($upd ate_trans_pro_t bl)) {

$t_date_subscri be=$fld['transaction_tb l.date_subscrib e'];
$t_date_expire= $fld['transaction_tb l.date_expire'];
$p_pro_id=$fld['product_tbl.pr o_id'];
$p_pro_des=$fld['product_tbl.pr o_des'];

}

[/PHP]

i usually do this when im using 1 table only and it works but when i make used of INNER JOIN...nothing happen...please help sir/madam..

TIA
Feb 20 '07 #1
4 2240
Atli
5,058 Recognized Expert Expert
Hi.

The way you write your query is very confusing.
I took it a re-aranged it so I could see what you were doing, and there is a weird cap there in your SELECT clause between t1.dat and e_expire.

Note: I'm not used to Postagre so I wrote this using as common SQL as I could master. Please correct me if I doing something MySQL specific there.
[PHP]
$sql_trans_pro_ tbl = "
SELECT
t1.date_subscri be,t1.dat e_expire , t2.pro_id, t2.pro_des
FROM
transaction_tbl as t1
INNER JOIN
product_tbl as t2 ON t1.pro_id = t2.pro_id
WHERE
t1.account_name ='$forder_name'
";
[/PHP]

Aside from that, you use the function pg_exec(). Are you sure you don't mean pg_execute() ? I couldn't find pg_exec() on php.net.
Feb 20 '07 #2
exoskeleton
104 New Member
hi im sorry..to make you confuse... its date_expire and we're using php 4.4.4 so pg_exec() is ok...

so it means i have to make use of "as" like you've written?
Feb 21 '07 #3
Atli
5,058 Recognized Expert Expert
No you can use the full table names if you want.
I just use it like this so it's easier to read.
Feb 21 '07 #4
exoskeleton
104 New Member
btw thank you sir
Feb 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6411
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName, Employees.LastName, TerritoryID, Employees.EmployeeID, RegionID, ProductID from Employees
6
9304
by: dmonroe | last post by:
hi group -- Im having a nested inner join problem with an Access SQl statement/Query design. Im running the query from ASP and not usng the access interface at all. Here's the tables: tblEmployees empId -- EmpName -- EmpRole -- EmpManager -------....------------.... ---------....--------------- 1........ dan yella..........1..........2
3
2383
by: Anila | last post by:
Hi Friends, My problem with Inner join is ... first i joined two tables and i got the result. after that iam trying to join one more table its giving syn tax error in JOIN condition. Here is the Query
0
1280
by: stanlew | last post by:
Happy New Year everyone! I'm new to both T-SQL and this forum. I'm currently doing an internship and my first task was to create a small program which will send an email detailing the sales of the previous day versus monthly targets and sales. Most of the parts were figured out and eveything was done in Visual Studio. The gist of the code was written in one large chunk of SQL code, as below: SELECT derivedtbl_1.family AS 'Family',...
9
11915
by: shapper | last post by:
Hello, I am used to SQL but I am starting to use LINQ. How can I create Left, Right and Inner joins in LINQ? How to distinguish the different joins? Here is a great SQL example: http://www.codinghorror.com/blog/archives/000976.html
0
8372
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.