SQL sintaxa pomoc

Moderators: cicans, TheHacker

Locked
NikolaPGcity
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Fri Dec 14, 2007 9:52 am

SQL sintaxa pomoc

Post by NikolaPGcity » Wed Jan 30, 2013 12:12 pm

Pozdrav

moze li mala pomoc oko sledece stvari u VM

tenutni query glasi

Code: Select all

$query = "SELECT COUNT(*) AS total FROM #__vm_product_category_xref WHERE category_id=" . $row->category_id;
i on mi izlista broj porizvoda koji se nalaze u toj kategoriji.

Dakle treba mi samo koji si objavljeni iliti aktivni proizvodi.
dakle

Code: Select all

prodcut_published = ' Y '

iz tabele vm_product

Hvala

aleksblack
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 144
Joined: Wed Feb 13, 2008 3:19 pm

Re: SQL sintaxa pomoc

Post by aleksblack » Wed Jan 30, 2013 4:05 pm

Trebalo bi da je ovako:

Code: Select all

$query = "SELECT COUNT(*) AS total FROM #__vm_product_category_xref WHERE (category_id=" . $row->category_id." AND product_published = 'Y')";
edit: greska, ne videh da vuce podatke za published iz druge tabele, morace da ide i JOIN

NikolaPGcity
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Fri Dec 14, 2007 9:52 am

Re: SQL sintaxa pomoc

Post by NikolaPGcity » Wed Jan 30, 2013 4:25 pm

aleksblack wrote:Trebalo bi da je ovako:

Code: Select all

$query = "SELECT COUNT(*) AS total FROM #__vm_product_category_xref WHERE (category_id=" . $row->category_id." AND product_published = 'Y')";
edit: greska, ne videh da vuce podatke za published iz druge tabele, morace da ide i JOIN
:-\


Locked

Return to “Joomla! dodaci”