Learn, Share, Build

302
September 20, 2017, at 1:32 PM

Table1:

id name | design | AddrId

1 Ram SE 101

2 Ravi JSE 102

3 Vas SSE 103

Table2:

AddrId | MobNo | EmailId

101 78945 a@gmail

101 54675 b@gmail

102 12345 c@gmail

103 45687 d@gmail

103 64587 d@gmail

output

AddrId | MobNo | EmailId

101 54675 b@gmail

102 12345 c@gmail

103 64587 d@gmail

Answer 1

There are no details, so here a general response:

SELECT DISTINCT col1, col2, col3 FROM table [WHERE a = 123] ;
SELECT col1, col2, col3 FROM table [WHERE a = 123] GROUP BY col1[, col2] ;
Answer 2

You can use MIN aggregate function with GROUP BY.

Query

select `AddrId`,
min(`MobNo`) as `MobNo`,
min(`EmailId`) as `EmailId`
from `your_table_name`
group by `AddrId`;
Rent Charter Buses Company
READ ALSO
Learn, Share, Build

Learn, Share, Build

1) Change

200
Learn, Share, Build

Learn, Share, Build

Table name - Masterdata

234
Learn, Share, Build

Learn, Share, Build

How to upload single and multiple images in server folder using springi tried with below code but its not working

294
Learn, Share, Build

Learn, Share, Build

I am asking this question as general purposeI wanted to know how searching a database works, suppose I have a certain tag or word with me and I want to get all the rows in which that tag is present and the database is MySQL

205