-1

I need SQL Query i mention details in sample image, I hope you understand

Thank you

Sample IMG

Haja
  • 74
  • 2
  • 11

3 Answers3

0

Try this query and let us know if it works for you:-

Select a.*, b.degree from table_a as a inner join table_b as b on b.log_id=a.log_id order by a.log_id asc

In this database query we have performed an inner join between the two tables and matched it based on log_id and at last order it in ascending order based on log_id itself.

Sanjana
  • 31
  • 2
  • Thanks for your reply, this code works but its return full data i need records only where log id = 102 – Haja Apr 28 '21 at 09:11
  • @Haja I've provided the `log_id` filter in my answer. – Larry Apr 28 '21 at 09:19
  • 1
    Select a.*, b.degree from table_a as a inner join table_b as b on b.log_id=a.log_id where a.log_id="102" order by a.log_id asc; – Haja Apr 28 '21 at 09:24
0

This should work:

SELECT a.*, b.degree
FROM a
LEFT JOIN b ON a.s_id = b.n_id
WHERE a.log_id = 102
ORDER BY a.log_id ASC;

Remember to change the table names a and b to the correct table names. More on this topic here.

Larry
  • 80
  • 8
  • Thanks for your reply larry..... Select a.*, b.degree from table_a as a inner join table_b as b on b.log_id=a.log_id where a.log_id="102" order by a.log_id asc; this code works for me – Haja Apr 28 '21 at 09:25
0

This code works:

Select a.*, b.degree from table_a as a inner join table_b as b on b.log_id=a.log_id where a.log_id="102" order by a.log_id asc;

Thanks you all

Haja
  • 74
  • 2
  • 11