mysql - How to query multiple tables in alphabetical order? -


i can apply query 1 table , want apply 5 tables in temporary table making records in alphabetical order. because has freezing problem more 5000 records , solution applying records when starts "a letter" , after "b letter" .... end "z letter" example

amanda anabele . . . zeplin zambia

the important thing first letter should in alphabetical order

shortly want make temporary table , applying query in alphabeticak order on first letter.. how can make it?

update   names inner join   (select   n1.id, n1.name, count(n2.id)+1 cnt        names n1 inner join names n2             on n1.name=n2.name , n1.id>n2.id    group n1.id, n1.name) s   on names.id = s.id set   names.name = concat(names.name, '.', s.cnt) 

if want gather data multiple tables, use union or - if not want/need filter out duplicates - union (which should bit faster).

example:

select col1, col2 table1 union select col3, col4 table2 

if want sorted, way (if remember correctly)

select col1 column1, col2 column2 table1 union select col3 column1, col4 column2 table2 order column1 

if facing performance issues, consider making temp table actual table. can 'clean' before (re)filling truncating , can use insert query per table want add. no need sort since can select/order on table.

if above doesn't you, perhaps add example of data start , desired result?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -