MySQL Forums :: PHP :: select and if statement
select and if statement
Posted by:
Hassan Ahmed ()
Date: March 09, 2013 03:46AM
al salam alikum =)
guys i want to know how to fix a complicated query
i have two tables
subsystem -> 1st table
topics -> 2nd table
subsystem :
subid
userid
type
typeid ;
topics :
topicid
title
catid
userid ;
and i got 3 records ( for example ) in the subsystem table like thie
1 - 1 - user - 1
2 - 1 - user - 2
3 - 1 - cat - 1
and i wanna to fetch the topics from topics table like this
query > select * from topics inner join subsystem on topics.userid=subsystem.userid where ( and here is the problem ! i want to fetch the topics where subsystem.typeid=userid "if subsystem.type=user" and where subsystem.typeid=catid "if subsystem.type=cat")
can anybody help !
and thnx =)
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.