php - MYSQL IF statement to different WHERE clause -


I am trying to solve a question on my app, this is the query to try to do this work .

Select from SELECT (IF article. Type = 1, join members at INNER members, IID_member = articles.author_id, join INNER company company.id_company = articles.author_id) Where the user says Is articles.tipe = '1' and user = '1';

I have a system that posts articles, but the same user can post on his name or the name of the company that he has created, so, what should I do Trying, if the type of articles is 1, the article was published by his company, and if otherwise, this type is 0, then he is posted on his name, if I use only 1 of them I am, so be mixed I have tried to give different approval but none of them is working for me, can anyone please help?

Based on the type of article, get records for both type-type = 0 and article_type = 1 For, if you are conditionally involved on the basis of the article type, here's the question:

 Select from * Select * (select article.type, article.name, member of the member article as the name INNER members Join members.id_member = articles.author_id where article_type = 0 union Select all articles.Type articles as user by name, company.name INNER member Join the company at thor_id INNER company as members.id_member = articles.au 

.id_company = articles.author_id where article_type = 1 < P>);

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -