Sponsored Content
Full Discussion: Complex MySQL Query(s)
Top Forums Web Development Complex MySQL Query(s) Post 302454076 by Neo on Friday 17th of September 2010 06:31:37 AM
Old 09-17-2010
We have billions of MySQL queries per month in these forums.

When the logic is in PHP, all is generally well. When the DB logic is complex, we tend to have problems.

There is a huge difference in theory and practice.

Generally speaking, keeping thing simple and stupid (the KISS principle) wins over complexity and clever most every time.

Of course, "to each his own" as they say. I am only talking from my experience of running a lot of third party MySQL/PHP code and what I find best and easiest to debug when a problem arises.
 

8 More Discussions You Might Find Interesting

1. Programming

Need help with complex SQL query (Sybase)

Hello, I have three tables. I need an SQL query (preferably Sybase) that will return all of the stringID values of table B where the following conditions exist: (1) B.intID = A.intID (2) B.intID != C.intID or (B.intID = C.intID and (C.v1 = 0 or C.v2... (2 Replies)
Discussion started by: chatieremerrill
2 Replies

2. Programming

How to query one to many mysql

Hi there, I have a hierarchical database that include 4 tables. Table A is the parent of B, B is Parent of C, C is parent of D. If I want to query everything in D that is associated with A.name, how do I do that? Thanks! YanYan (0 Replies)
Discussion started by: pinkgladiator
0 Replies

3. Web Development

mysql query help

hello all i have 2 columns every column in the following format column1 2011-04-01 11:39:54 column2 2019-02-03 00:00:00 i want get difference between above data as following 2 days 11:39 how to do so ? i tried many functions but nothing works please advice what is the query... (6 Replies)
Discussion started by: mogabr
6 Replies

4. Shell Programming and Scripting

Complex query

A file whose location i am not aware of contains the below text <url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP) (HOST=ngm2sn1p2-vip.mybank.net)(PORT=4001))(ADDRESS=(PROTOCOL=TCP)(HOST=ngm2sn2p2-vip.mybank.net)... (1 Reply)
Discussion started by: mohtashims
1 Replies

5. Programming

mysql query help

Hello i have created mysql query to compare to values and get difference in percentage as following: SELECT file_name, 100 - ((100 * (SELECT file_count FROM xipi_files z WHERE x.file_group = z.file_group AND x.file_name = z.file_name AND z.insert_date = CURDATE( ) - INTERVAL 1 DAY)) /... (1 Reply)
Discussion started by: mogabr
1 Replies

6. Shell Programming and Scripting

Complex string search query.

Hi, I wish to find the latest occurance of the below string in my log file. Once found, I need to search the below string after the above string and display this Request 331489 has passed or Request 331489 has failed I would like my query to be platform... (11 Replies)
Discussion started by: mohtashims
11 Replies

7. Shell Programming and Scripting

Complex Query regarding folder size

Hi, I provide the path to a folder. I would like so drill in each folder inside the folder i gave and show me the size in human readable form du -sh <folder-name> of the top 8 folders with maximum sizes. For example: Path of the folder: "/opt/app/myapp" has these directories. ls... (2 Replies)
Discussion started by: mohtashims
2 Replies

8. Programming

Need help in mysql query

Hi All, i have a table in mysql with the following data Table name Test Assettype Serial_No Status location Mouse 123456 In Stock chennai Mouse 98765 Allocated chennai Keyboard ... (2 Replies)
Discussion started by: venkitesh
2 Replies
MYSQL_SET_CHARSET(3)							 1						      MYSQL_SET_CHARSET(3)

mysql_set_charset - Sets the client character set

SYNOPSIS
Warning This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: omysqli_set_charset(3) oPDO: Add charset to the connection string, such as charset=utf8 bool mysql_set_charset (string $charset, [resource $link_identifier = NULL]) DESCRIPTION
Sets the default character set for the current connection. o $charset - A valid character set name. o $ link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection is found or established, an E_WARNING level error is generated. Returns TRUE on success or FALSE on failure. Note This function requires MySQL 5.0.7 or later. Note This is the preferred way to change the charset. Using mysql_query(3) to set it (such as SET NAMES utf8) is not recommended. See the MySQL character set concepts section for more information. mysql_client_encoding(3), Setting character sets in MySQL, List of character sets that MySQL supports. PHP Documentation Group MYSQL_SET_CHARSET(3)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy