Jump to content

Where clause error


unemployment

Recommended Posts

The problem is right before the WHERE in your query.

 

I actually am using multiple unions before the where and I think that is the problem.  I should probably put the where in the unions.

 

But now I'm getting a new error. #1052 - Column 'approved_date' in where clause is ambiguous

 

One of the unions is posted below.

 

(

            SELECT

                users2.id,

                users2.firstname,

                users2.lastname,

                users2.username,

                '' AS industry,

                '' AS stage,

                '' AS companytag,

users2.gender,

                users3.accounttype,

                users3.country,

                users3.state,

                users3.city,

                UNIX_TIMESTAMP(`partners3`.`approved_date`) AS `approved_date`,

                users3.id AS FeedId,

                users3.firstname AS FeedFirstName,

                users3.lastname AS FeedLastName,

                users3.username AS FeedUserName,

                '' AS action_id,

                '' AS details

            FROM users

            INNER JOIN partners ON partners.user_id = users.id AND partners.approved = 1

            INNER JOIN users users2 ON users2.id = partners.friend_id

            INNER JOIN partners partners3 ON partners3.user_id = users2.id AND partners3.approved = 1

            INNER JOIN users users3 ON users3.id = partners3.friend_id

            WHERE users.id = ${uid}

            AND `approved_date` = ${time}

        )

 

Link to comment
https://forums.phpfreaks.com/topic/235321-where-clause-error/#findComment-1209273
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.