Jump to content
php.lv forumi

Recommended Posts

Posted

Jautājums, ko tu vispār vēlies panākt? atlasīt 10 audi un 10 bmw?

select t1.title, t2.title FROM
( SELECT DISTINCT audi.title FROM audi ORDER BY audi.dateadded DESC ) t1, ( SELECT DISTINCT bmw.title FROM bmw ORDER BY bmw.date DESC ) t2
LIMIT 10;

Iespējams šitas strādās :)

Posted (edited)

jā un abus sakārtot vienlīdz pēc datuma.

 

hmm interesanti ar šo kvēriju man rāda to pašu ko pirmais.

11v7emfjybea6eq19k.png

kreisajā pusē bmw bet labajā audi

Edited by sega99
Posted (edited)
(
	( SELECT 'audi' as `type`, audi.title as title, audi.dateadded as added FROM audi ORDER BY audi.dateadded DESC LIMIT 10 )
	UNION
	( SELECT 'bmw' as `type`, bmw.title as title, bmw.date as added FROM bmw ORDER BY bmw.date DESC LIMIT 10 )
);

 

Šitā vajadzētu strādāt pareizi, vienīgi, ir nevis labā un kreisā puse, bet pielikta kolona tips.

Un vispār mašīnas vajadzētu glabāt vienā tabulā, un vienkārši pielikt papildus lauku ražotājs.

Edited by draugz
Posted

 

(
	( SELECT 'audi' as `type`, audi.title as title, audi.dateadded as added FROM audi ORDER BY audi.dateadded DESC LIMIT 10 )
	UNION
	( SELECT 'bmw' as `type`, bmw.title as title, bmw.date as added FROM bmw ORDER BY bmw.date DESC LIMIT 10 )
);

 

Šitā vajadzētu strādāt pareizi, vienīgi, ir nevis labā un kreisā puse, bet pielikta kolona tips.

Un vispār mašīnas vajadzētu glabāt vienā tabulā, un vienkārši pielikt papildus lauku ražotājs.

klausos ser un sanaca ! :)

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...