Assuming where is required, the following 218 results were found.
`value`) -- SELECT -- 1, 'Joel Lipman', 'Webmaster', @exampleLocalVariable -- FROM -- `my_old_database`.jos_sampletable -- WHERE -- `my_old_database`.jos_sampletable.user_id=1; -- You could copy and paste this whole query and then remove everything --...
Joomla 3.x -- Banners: UPDATE `v34_db`.`v34_banners` SET `created_by` = @v25_admin_id, `created_by_alias` = @v25_admin_alias WHERE `created_by` = @v34_admin_id; UPDATE `v34_db`.`v34_banners` SET `modified_by` = @v25_admin_id WHERE `modified_by` =...
$db->quoteName('#__users', 'u') . ' ON (' . $db->quoteName('u.id') . ' = ' . $db->quoteName('p.user_id') . ')') $query->where($db->quoteName('u.real_name') . ' LIKE '. $db->quote('\'%smith%\'')); $query->order('u.real_name ASC'); // Reset the query...
T-SQL Record Separatorhttps://joellipman.com/articles/database/t-sql/t-sql-record-separator.html
replying "why would you want to do that?". Anyway, I was looking for something like the record separator in Oracle SQL*Plus where a row of data (blank or made of symbols) separates two sets of data from within the same select query based on a column...
TIME( DATE_ADD( w.date_started , INTERVAL w.actual_duration SECOND ) ) AS TimeOut FROM jdlv2_joestimesheets_works w WHERE DATE(w.date_started)=DATE( DATE_ADD( NOW( ) , INTERVAL 0 - WEEKDAY( NOW() ) DAY ) ) UNION ALL SELECT DATE( DATE_ADD( NOW( ) ,...
search an entire database for a particular string of word(s). I've posted my own as well as some others I've lifted from elsewhere, as they worked with my environment, to put them in one place on a website I've bookmarked (my personal site :c) My own...
A quick article on how to use the where clause in a joomla database query. Why? In response to a member, I use the old form where I can include the whole SQL statement: $db->query('SELECT * FROM #__myTable WHERE condition1=true or condition2=true')...
$user_list_query=" SELECT DISTINCT u.UserID, CONCAT(u.FirstName, ' ', u.LastName) AS 'Fullname' FROM Users u WHERE u.StatusType NOT IN ('expired','guest','test account') AND u.TeamID='$t_value' ORDER BY CONCAT(u.FirstName, ' ', u.LastName) "; Activity...
Regular Expressions in SQLhttps://joellipman.com/articles/database/regular-expressions-in-sql.html
Oracle PL/SQL Looking for abnormal data, note the circumflex to exclude the clean alphanumeric rows: SELECT * FROM STUDENTS WHERE REGEXP_LIKE(S_SURNAME, '[^a-zA-Z0-9]') -- returns all rows where the student surname contains non-alphanumeric characters...
and WeekNumber from the weekstructure table based on the given date SET @setId = (SELECT TOP 1 SetId FROM WEEKSTRUCTURE WHERE StartDate BETWEEN DATEADD(day, -6, @specifiedDate) AND DATEADD(day, 6, @specifiedDate)) SET @weekNumber = (SELECT TOP 1...
@StudentReference [int] respectively). Most of the remaining datasets use the resulting @StudentReference number in their "where" clause. A student always has a "Student Reference" but not necessarily a student AD account (enquired/applied only). So...
We have a stored procedure which contains two select queries. The first query will retrieve a student ID number where the input parameter is the student's username. The second query will return data using the student ID number found in the first query....
has a field containing the ID numbers of images relevant to this room. The Problem? When I select specifying the statement "WHERE IN (c.RoomImages)", this is interpreted as a string and when converted to a number only retrieves the first value before...
The Why So I find myself writing increasingly complex SQL scripts and it's at the stage where we need to optimize the queries because some scripts are noticeably slow (as observed by the customer...) and then others not. The What I'm going to run these...
this operator to search for an exact number of occurrences of the preceding character or subexpression. For example, to find where 'a' occurs exactly 5 times, you specify the regular expression: a{5} This expression matches: aaaaa The expression does...
FROM "Purchase Order Items" poi2 LEFT JOIN "Purchase Orders" po2 ON po2."Purchase Order ID" = poi2."Purchase Order ID" WHERE poi2."Item Name" IN ( 'delivery' , 'Delivery' ) GROUP BY po2."Purchase Order ID" ) pshipping ON pshipping."PO ID" = po."Purchase...
value (Maximum) ** ** ** ** Additional: ** ** - For performance, restrict this by schema otherwise occurrences in tables where the column is ** ** the referred to in a view, will appear twice: ** ** Change: ** ** WHERE DATA_TYPE IN ('char', 'nchar',...
DataScramble). How? CREATE PROCEDURE [Common].[usp_ScrambleMultivalue] ( @TableName VARCHAR(MAX), @ColumnName VARCHAR(MAX), @WhereClause VARCHAR(MAX) = NULL ) AS...
t1.Date Date FROM ( SELECT MAX(a.VisitorID) ID, a.VisitorIP IP, a.DateTimeStamp Date FROM custombu_stats_visits a WHERE YEAR(a.DateTimeStamp)='2010' GROUP BY a.VisitorIP ORDER BY MAX(a.VisitorID) DESC ) t1 LEFT OUTER JOIN wikimedia_user b ON...
List MediaWiki Articleshttps://joellipman.com/articles/cms/mediawiki/list-mediawiki-articles.html
is extra to your standard MediaWiki setup and one that was customized for my day job). Thought I already had this somewhere on my site, so it took a while again but I've posted my finished query here: The base query to list mediawiki articles Page ID,...