Skip to content

Tag: mysql

Joining table only once in SQL

I’m sure this is very basic, but I’ve hit a brick wall. First post here, long time reader. I’ve got two tables, one is a list of customers, one is a list of their activity by month. For some unknown reason, some of the data in the activity column is duplicated and it’s causing me error…

Variable to replace %s for sql is not getting honored

I have a table with single empty row inserted. Later I want to update column with some value into the row. I am trying to compose a function which will work for all the columns as shown upon execution update_column(‘fieldName’, 10), getting following error. Any help is appreciated. Failed to execu…

How to get first character-set of string in sql?

I want to get 202500 and 37500 without not adding removed characters (in eg: 7, 5). (ie. first string gp in columns).sample-image description here But, I don’t know to get string in front of blank string “”. I have a little exp in sql. pls show me ans. Answer Use SUBSTRING_INDEX instead | Ex…

Get last record from joined table

I have two tables DOCUMENT and SIGNATURES, like below And I’m try to get last signature name. I have a SQL FIDDLE with database and query, but when run search no record has found. http://sqlfiddle.com/#!9/b98474/3 Here my query Answer A simple method is a correlated subquery: With an index on signatures…