sql

  • Hibernate query "or condition" won't work 2018-09-20

    I am trying the following hibernate query but it always gives me a wrong result: @SuppressWarnings("unchecked") @Override public List<Jcelulasmin> getAllOthers(int id, String username) { Session session = this.sessionFactory.getCurrentSess

    Tags: mysql, sql, java, hibernate, hql
  • how to convert .sql file to .xlsx(excel) without third party tools 2018-09-17

    i am using mysql server using mysqldump import command i have taken backup of my database in backup.sql file Now i want convert this file in MS excel2010 please suggest me easy way with out using any third party tools .Thank you --------------Solutio

    Tags: mysql, sql, excel, excel 2010
  • SQL max by 2 column, or first and last aggregate function 2018-09-16

    How to get max by colum1 1 then by colum 2 in sql? and is there aggregate function like first or last? I tried 2 ways: 1-it's get me max date but the max price is not associated with max date: SELECT doc_kits_t.DateOper, kits_t.DocId, kits_t.GoodId,M

    Tags: sql, sql server
  • Strange behaviour of two simple SQL Statement (Error) and one is crashing 2018-09-11

    I have a database table with 50.000 customer data records. When I run this query: SELECT * FROM customer --> The result is, that I get only 22.000 data records. When I run this query: SELECT * FROM customer WHERE customer_id < 50.001 --> The resu

    Tags: sql, sql server, select, sql server 2008 r2
  • Update Column based on Bulk insert from CSV SQL 2018-09-08

    I am trying to update a table based on the CSV file. I have got list of Id's and trim number in CSV and I need to update the Trim number based on the specific id's in the SQL table. So far the script I have written -- Create a temporary table for the

    Tags: sql, sql server, csv
  • Create trigger to update the table row 2018-08-28

    Hi there i would like to create a trigger for (It's MYSQL) what i had first, which doetn't work correct, keep getting project_id to 0 and hash value and insert the project_id_md5. CREATE TRIGGER project_auto_md5 BEFORE INSERT ON project FOR EACH ROW

    Tags: mysql, sql, triggers
  • PHP + Mysql Select and Count 2018-08-22

    I need get specific values and count all values from a MySQL table, i need get the best performance, my question is: What is better and faster? - Use two separate queries: $TBCount = $Resps = $MySQL->query('SELECT COUNT(*) FROM T1'); $Resps = $MySQL-

    Tags: php, mysql, sql
  • Convert SQL datetime to C# string 2018-08-18

    I'm trying to convert the ReturnDate to a string. As of now it's stored in the database as a Datetime and I wish to convert to a string in C#. [Display(Name = "Return Date")] public string ReturnDate { get { return this._ReturnDate; } set { this

    Tags: sql, datetime
  • Sql Query to get only non null values in a row in Sql Sever 2018-08-14

    How to get columns with only non null values. Say Output of CTE1 is ColA , ColB , ColC , ColD , ColE 1 , 2, NULL, NULL, NULL So in I must write a CTE2 that takes CTE1 (ColA to Col E) (ONLY ONE ROW ALWAYS) as Input and returns only Non null Values i.e

    Tags: sql, sql server 2008
  • Make search query with LIKE faster 2018-08-07

    I have an application where search query takes too much time. There are different search queries where LIKE (with '%__%') operator is mostly used. I need some general guidelines (do's and don't s) for making a better and faster search query. --------

    Tags: sql, tsql, sql server 2008 r2
  • IF statements on SQL queries 2018-08-06

    I have the following query : SELECT id, status from applications Now, status can either be open, matched, completed. But when the query displays the results, I want open to be displayed as "In Progress", matched as "Approved" and compl

    Tags: sql
  • Count Table Record Value and Assign Count Value as Variable in PHP mySQL 2018-08-03

    I have a database with area details like state name, district, city, area size, ... Now I would like to count a districts value from state name and assign that value to some variable for showing html page. Example: The tamil nadu state includes total

    Tags: php, sql, html, count
  • Java sql parser with antlr 2018-08-02

    This question already has an answer here: antlr4 sql grammar 1 answer I need in simple ANSI SQL parser and am looking for some instant solution. Does antlr have SQL grammar out of the box or should I write it on my own from scratch? --------------Sol

    Tags: sql, java
  • trouble with string to date conversion 2018-08-02

    Greetings StackWarriors.... I am in need of some help. I have this SQL Select statement: SELECT GEOID, cast(LEFT(PP.PurchaseDate,4) + RIGHT(Left(PP.PurchaseDate,6),2) as integer) AS Month FROM PropertyParametersNew PP join PropertyTracts PT on PP.Par

    Tags: sql, sql server, date
  • Display only rows that do not match the control table 2018-07-24

    I'm currently having a problem since I can't really explain it in words it's better if I put a test table here. Table1: Source_DB Source_TBL Source_Col Target_DB Target_TBL Target_Col Metric Source_VAL Target_Val _____________________________________

    Tags: sql, teradata
  • How correct query for group by when joining table using left join 2018-07-23

    This query keeps returning the error: not a GROUP BY expression Can someone please help me correct my query? I'm not good at joining tables. select distinct(nama), namabapa, data_saranabapa.nokpbapa, namaibu, data_saranaibu.nokpibu from ((data_semua_

    Tags: sql, join, group by
  • Display the name of the maximum salary holder (WITHOUT USING A SUBQUERY) 2018-07-18

    Say there's a table Name Salary Joe 4000 Steve 6000 I could just do this select name from emp where salary = (select max(salary) from emp); but is there a way to do this without using a subquery?? Please help. EDIT: Sorry I forgot to mention that I'm

    Tags: sql, oracle
  • Oracle: Need number values converted to text AND preserved - resolved 2018-07-18

    Resolution: Oracle does not store or display formatting (even on non-persisted values as shown below). A Formatter must be applied for anything other than that. Thanks to the folks that posted. Question: Thought this would be trivial. If a decimal va

    Tags: sql, oracle, formatting, decimalformat, oracle12c
  • Search query for multiple search terms 2018-07-11

    I'm running Laravel 5 and have built a small search function: $q = Input::get('q'); $search_terms = explode(' ', $q); $user_query = User::select(); $news_query = Article::select(); foreach ($search_terms as $term) { $user_query->where('username', 'li

    Tags: php, mysql, sql, laravel
  • SUM column values with group by aggregate taking care of null values 2018-07-04

    I have a table employees. The data is inserted as (in oracle): ID EMP_NAME DEPT_NAME EFFORTS ACTIVITY_DAY 633 ALEX XYZ 30 13-May-15 633 ALEX XYZ 30 14-May-15 633 ALEX ABC 30 13-May-15 633 ALEX XYZ 0 15-May-15 But I need to fill the efforts as 30 for

    Tags: mysql, sql, oracle

Copyright (C) dskims.com, All Rights Reserved.

processed in 2.661 (s). 9 q(s)