Miguel
What i need is to list all the products and show the type name of
each of them.
What you need is a join
(http://dev.mysql.com/doc/refman/5.0/en/join.html), eg:
SELECT t.id, t.id_type, t.name, t.desc, t.price, p.name
FROM tbl AS t
INNER JOIN products AS p USING (id)
PB
-
Hi guys,
I am kinda new to mysql and on my endeavour to build a backend for a
site i am building, i need to fetch data from a couple of tables, but
dont know how to do it with a single select.
Heres the problem:
first table (products):
id
id_type
At 1:23 -0400 6/26/03, [EMAIL PROTECTED] wrote:
I grown my db to 4 tables 8). I'm going to ask this plainly in
hopes that my syntax in ok:
I know how to SELECT * from 2 related tables and get all the records
listed in the resultset.
(Either using INNER JOIN or WHERE.) Now... and I have been
Ok, I trying to get this example... what is table1 t1, table2 t2,
table3 t3, table4 t4, I mean, what does the t1, t2, t3, t4 represent?
If you say, table 1, table 2, etc well, I assume that, but isn't
that there already?
Let me, or may I, give ask again with my visual? Here are my tables
[EMAIL PROTECTED]:
Ok, I trying to get this example... what is table1 t1, table2 t2,
table3 t3, table4 t4, I mean, what does the t1, t2, t3, t4 represent?
If you say, table 1, table 2, etc well, I assume that, but isn't
that there already?
t1, t2 etc represents an alias for the table.
[EMAIL PROTECTED] wrote:
Ok, I trying to get this example... what is table1 t1, table2 t2,
table3 t3, table4 t4, I mean, what does the t1, t2, t3, t4
represent? If you say, table 1, table 2, etc well, I assume that,
but isn't that there already?
Let me, or may I, give ask again with my
At 2:58 -0400 6/26/03, [EMAIL PROTECTED] wrote:
Ok, I trying to get this example... what is table1 t1, table2 t2,
table3 t3, table4 t4, I mean, what does the t1, t2, t3, t4
represent? If you say, table 1, table 2, etc well, I assume
that, but isn't that there already?
t1, t2, etc. are
I grown my db to 4 tables 8). I'm going to ask this plainly in hopes
that my syntax in ok:
I know how to SELECT * from 2 related tables and get all the records
listed in the resultset.
(Either using INNER JOIN or WHERE.) Now... and I have been looking
some books!
How do get a resultset of
Hi NG, this is my first visit here, so please be gentle!!!
I have a table of products (`prods`), and a separate table of product uses
(`uses`) and the products are linked to their uses by a list (`prod_uses`).
What I need to be able to do is allow a search of products by their use and
I am
(25) YES (NULL)
prod_uses
pid int(11) 0
uid int(11) 0
I hope this works out for you.
Marcel
- Original Message -
From: Mikey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 12:54 PM
Subject: SELECT from multiple tables...
Hi NG, this is my first visit here, so
, 2003 8:17 PM
Subject: Re: SELECT from multiple tables...
Hi,
It would work something like this:
SELECT * FROM products p, uses u, prod_uses pu WHERE p.pid=pu.pid AND
u.uid=pu.uid AND productname='product 1';
Where
products
pid int(11) PRI (NULL) auto_increment
productname varchar(25) YES
Hi,
I got the following query:
SELECT * FROM t1,t2
In the result I get as column just the column name only, but I like to
get the table name with it, just I must use it in the where clause. How
can I do this?
Thanks in advanced,
Frank de Bot
WHERE D.CompanyID = 36
HTH,
Tore.
- Original Message -
From: Frank de Bot [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 24, 2003 5:33 PM
Subject: Select from multiple tables
Hi,
I got the following query:
SELECT * FROM t1,t2
In the result I get as column just
Thanks Joseph and Kelly. I think merge tables will be a good solution
for me.
Veysel Harun Sahin wrote:
Hello,
I have a problem with select statetement. I need to query and select
records from multiple tables which have the same column types. I have
done this with left join but my query
Hello,
I have a problem with select statetement. I need to query and select
records from multiple tables which have the same column types. I have
done this with left join but my query became so complex. Because i have
written left join between all of my tables and also if i need to query
Hello,
You can define a merge table and run your select on it.
Check the manual for details: http://www.mysql.com/doc/en/MERGE.html
Regards
Joseph Bueno
Veysel Harun Sahin wrote:
Hello,
I have a problem with select statetement. I need to query and select
records from multiple tables
Assuming that you're joining data based on colB, you
would use:
select t1.colA,t2.colA,t3.colA
from tblA t1
inner join tblB t2 on t1.colB = t2.colB
inner join tblC t3 on t1.colB = t2.colB
where...
You can alias the table names, but there's really no
way to get around specifying the table
17 matches
Mail list logo