Skip to content

MySQL category with parent_id – SELF Join

My SQL table called categories has the following structure: I would like to know if it’s possible to JOIN the same table and present the parent_id name. I can do this by PHP code, but I would like, because of performance issues, to retrieve as SQL Query. See example at SQLFiddle I’ve managed to JO…

How to Select Top 100 rows in Oracle?

My requirement is to get each client’s latest order, and then get top 100 records. I wrote one query as below to get latest orders for each client. Internal query works fine. But I don’t know how to get first 100 based on the results. Any ideas? Thanks. Answer Assuming that create_time contains th…

Select distinct returns duplicates

I have the following query: But it returns duplicates in TK.TICKETID attribute. And if i remove other attributes all ok. e.g. How can I return only a single record per TK.TICKETID? Answer Try this:

Adding prefix to value in SQL row values

I have about 10000 rows in SQL table, and I need to add a prefix before each value of user column. Example: I have value names like John, Smith, and so on, and I need to set QA-John, QA-Smith, and so …

SQL query fails when using pyodbc, but works in SQL

I am having some trouble with what should be a very simple script. I am just trying to create a new SQL Server database using the Python pyodbc module. The “sqlcommand” parameter I am attempting to …

query hbase like normal sql

I know Hbase is not like normal SQL. But is it possible to query Hbase something like this? select row-key from Table where cf:first=”ram” and cf:middle=”leela” and cf:last=”ban”; // ram(first …

Best way to start SSIS catalog or SSIS package remotely

I need to execute an SSIS package or an SSIS catalog remotely. What is the best way to acomplish this? I’m using: Visual Studio 2012 SQL Server 2012 Answer I am almost positive you need an integration server to accomplish this. The package is stored in the MSBD of the integration server and called by jo…

Set server output only in spool

Is it possible to set the server output only into the spool file and not in the shell ? Inside MY_PROCEDURE I have this : I would like to put Hello World only in log.txt, not in the screen shell. Answer Simplest way is to pipe the unix output to /dev/null