tags:

views:

34

answers:

1

My query reads as follows:

"SELECT config.*, utinfo.* userinfo.* "."FROM config, utinfo, userinfo "."WHERE config.cxid = utinfo.xid"."AND utinfo.uid = userinfo.id"

It was working fine before i added the

."AND utinfo.uid = userinfo.id"

part at the end.

Easier way to do this? Or something im missing?

+5  A: 

A space:

"WHERE config.cxid = utinfo.xid "
                               ^ - add space here

Edit:

Since that alone is not the problem, I'll make an educated guess as to what you're really trying to achieve. It looks to me like you're trying to select all the records in utinfo that have a config ID, and those that have a userinfo ID. An INNER JOIN would be the best way to handle this:

SELECT *
FROM utinfo
INNER JOIN config ON config.cxid = utinfo.xid
INNER JOIN userinfo ON userinfo.id = utinfo.uid

Also, in production environments, I would stay away from SELECT * as it could break your application if you add or remove a column in the database.

John Rasch
still not working
Patrick
thanks all for the help
Patrick