Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Combining two select queries into one ?!?
October 8, 2005, 9:00 pm
rate this thread
I am wondering if there is a way of combining two SELECT statements into
a single query.
Here's the obligatory example to clarify things:
SELECT id WHERE name=mike
SELECT bills WHERE nameid=12 (12 being the result of the first query)
Right now I am executing two separate calls and I would ofcourse like to
bring that down to a single call.
Any help or pointers would be more than appreciated,
Re: Combining two select queries into one ?!?
This query won't work. Table name is missing from it and value is not
inside '' characters.
This also is missing the table name.
But perhaps something like this:
select useraccount.id,bill.* from useraccount where name='mike'
left join bill on useraccount.id=bill.nameid;
Please note that the query might not be usable just like that. It
depends on what kind of results you wish to get and since you didn't
even provide working example, it is impossible to tell what you really
expect to get.
- » What back-end database should I use for this project ?
- — Next thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum