Problema SQL Join
Last Updated: Mar 26 2016 17:03, Started by
93kts
, Mar 26 2016 12:13
·
0

#1
Posted 26 March 2016 - 12:13

Buna ziua !
Ma poate ajuta cineva cu : SELECT c.* , p.* FROM cotos_escorte c,cotos_poze_escorte p WHERE c.id=p.e_id preia corect dar as vrea pentru tabela cotos_escorte sa-mi afiseze doar 10 iar pentru cotos_poze_escorte doar 1.. Cum pot face ? |
#2
Posted 26 March 2016 - 13:32

select top 10 *
from (Select row_number() over (partition by c.id order by p.id) as Part_id, c.id as ce_id, p.id as cpe_id, * from cotos_escorte c inner join cotos_poze_escorte p on c.id=p.e_id order by c.id, p.id) x where x.part_id = 1 order by x.ce_id Daca baza de date este MSSQL, regasesti la link-ul urmator mai multe informatii: https://msdn.microso...y/ms189461.aspx |
#3
Posted 26 March 2016 - 13:56

select top 10 * from (Select row_number() over (partition by c.id order by p.id) as Part_id, c.id as ce_id, p.id as cpe_id, * from cotos_escorte c inner join cotos_poze_escorte p on c.id=p.e_id order by c.id, p.id) x where x.part_id = 1 order by x.ce_id Daca baza de date este MSSQL, regasesti la link-ul urmator mai multe informatii: https://msdn.microso...y/ms189461.aspx Mersi mult ! Acum incerc sa vad ce iese ! :-D Imi da : mysql_fetch_array() expects parameter 1 to be resource, Edited by 93kts, 26 March 2016 - 14:03. |
#4
Posted 26 March 2016 - 17:03

Mda, in Mysql trebuie pusa o virguala intre ...partiton by c.id, order by p.id...
Ex: http://stackoverflow...number-in-mysql |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users