Jump to content
php.lv forumi

sql union piešķiram tabulai unikālo atslēgu


anonīms

Recommended Posts

$sql = mysql_query("SELECT id, nosaukums, datums FROM ".DB_PREFIX."jaunumi 
                   UNION
                   SELECT id, nosaukums, datums FROM ".DB_PREFIX."apgerbi
                   UNION
                   SELECT id, nosaukums, datums FROM ".DB_PREFIX."cenas 
                   ORDER BY datums DESC LIMIT $from, $max_results");

 

nepieciešams pielikt kkā kādu zīmi, kas norādītu no kuras db nāk. Atceros, ka bija reiz man kods, kur tas bija kkā 1 AS tips un tālāk attiecīgi if($row['tips'] == 1), tātad jaunumi. Tā kā pie saviem arhīviem netieku un keywordu arī īsti nezinu kā meklēt, tad greižos pie jums.

 

vajag atšķirt no kuras tabulas nāk ieraksts.

Paldies.

Link to comment
Share on other sites

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...