Jump to content

Accessing complete table data with inner join


schalkl
Go to solution Solved by Barand,

Recommended Posts

Hi All.

I am stuck at the moment and hope that someone can help.

My problem is as follow:

$sql4 = ('SELECT *,COUNT(*) FROM tt_new_make
inner join tt_new_size
ON tt_new_size.no=tt_new_make.no
inner join tt_new_rub
on tt_new_rub.no=tt_new_make.no
WHERE tt_new_size.s_line_no1="12R" GROUP BY m_line_no1, line_no1');
$sql5 = mysql_query($sql4);

The above results give me the correct answer according to tt_new_size.s_line_no1="12R" which is 2, but I actually need to broaden the querry to access all table fields.

 I have data on another 2 coulombs called s_line_no2 and s_line_no3, which I also need - see attachment. The correct answer should be 4, not 2.

 

 

post-73645-0-47054500-1455902618_thumb.jpg

Link to comment
Share on other sites

  • Solution

Hi Sen.

 

If you can't work out that my name on my posts is in exactly the same place that your name is on your posts, then I am not sure you are ready for this.

 

Anyway, your table should look like this.

no   |  seq   |  s_line_no
-----+--------+------------
  32 |   1    |    315
  34 |   1    |    12R
  34 |   2    |    12R
  34 |   3    |    12R
  35 |   1    |    12R
  37 |   1    |    Other

If the user enters more than one value then you write more than one row.

 

Now all you need is a count of the rows where s_line_no = 12R to get the answer of 4.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.