Ok here is where I'm at. I have two tables, replies and jobs. I want a query that gets all the replies where the replytext equals one and I also want to get all the jobs. I'm not too familiar with SQLs conditional statements so I'm having some problems with this one. I'm trying something like
SELECT If RText = 1 THEN SUM(RText), COUNT(ReplyID), FROM...GROUP BY JobID
Obviously this is working. Is what I'm trying to do even possible?
crazy query
Moderator: General Moderators
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Try
Are these Tables Related?
If not, then you may select them in different queries,
If they are then you can select all of them,
and check those you want, in your actual script.
Im not really sure what your problem is,
but perhaps this will help.
If not, then you may select them in different queries,
If they are then you can select all of them,
and check those you want, in your actual script.
Im not really sure what your problem is,
but perhaps this will help.
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
if anyone else has this question, i did it like this
This gave me a total count of replies for each job alaong with a count of replies where the text was 1
then I foound out none of it mattered anyways...
Code: Select all
SELECT COUNT(IF(RText = 1,1,NULL)),COUNT(JReplyID) FROM Replies, Jobs Where Replies. JobID = Jobs.JobID GROUP BY Jobs.JobIDthen I foound out none of it mattered anyways...