Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases.

Filter by
Sorted by
Tagged with
21
votes
1answer
12k views

How to combine ANDs and ORs in the WHERE clause using a Query Object?

Given the desired SQL below, where Cond1 and Cond2 must be met OR Cond3 must be met for selection, what is the correct way to use getQuery() to achieve it? Desired SQL: Condition1 and Condition2 ...
3
votes
4answers
2k views

How to write my MySQL query with JOIN logic using JDatabase methods?

I'm having a difficult time translating this SQL script to JDatabase methods because I can't find the AND query method. SELECT user.firstname, user.lastname, leadership.leadname, leadership.lead_des ...
4
votes
3answers
890 views

How to rewrite SQL-query with CASE/WHEN to Joomla-based “format”

I have the following SQL-query to database: $jinput = JFactory::getApplication()->input; $category_id = $jinput->get('virtuemart_category_id'); $db = JFactory::getDBO(); $query = $db->...
2
votes
3answers
66 views

Confusion about using two select() method calls in one query

I am using Joomla's JDatabaseQuery methods to select some columns from two joined tables, but I don't understand something about the following snippet. //Initialize variables. $db = JFactory::getDbo()...
2
votes
2answers
3k views

Error 1146 while installing K2 extension

While installing K2 extension, Joomla 3.0, GoDaddy hosting) received error message: Table 'iWebazoid.bq1ry_k2_categories' doesn't exist SQL=SHOW FULL COLUMNS FROM bq1ry_k2_categories Unable to ...
1
vote
3answers
2k views

Retrieving multiple results from the database

I don't have much Joomla or PHP experience so I'm probably missing something really simple. I'm trying to load a certain list of user IDs into an array. This code works except it only loads one result....
0
votes
1answer
330 views

How to SET a user-defined MySQL variable and increment it to produce ranking values with JDatabaseQuery?

I'm trying to write this query: SET @rownumber = 0; UPDATE #__hikers SET rank = (@rownumber:=@rownumber+1) ORDER BY score DESC; like JDatabaseQuery, but still got an error. Please help UPDATE: I ...
-1
votes
3answers
6k views

1054 Unknown column 'extra_query'

I have a new Joomla installation with this error: 1054 Unknown column 'extra_query' in 'field list' SQL=SELECT DISTINCT update_site_id, type, location, last_check_timestamp, extra_query FROM ...