Is there a way how to directly convert value in milliseconds (e.g. 1480515430991) to Oracle TIMESTAMP(6) column? Like some pattern I'm missing for the TO_TIMESTAMP or TO_DATE functions? All I could find so far are some calculations with intervals and
I have two Tables. table A id name Size =================== 1 Apple 7 2 Orange 15 3 Banana 22 4 Kiwi 2 5 Melon 28 6 Peach 9 And Table B id size ============== 1 14 2 5 3 31 4 9 5 1 6 16 7 7 8 25 My desired result will be (add one column to Table A, w
I have a table as follows : A| B| C| D| 1 3 1 25/2/2016 2 4 2 25/4/2016 2 5 1 22/2/2016 3 5 1 23/2/2016 3 5 1 23/6/2016 Now I want the result set with following condition : All rows with value of B as 3 or 4. Include rows with value of B as 5 only wh
I have two tables in SQL Server: EMP On_Vacation with colums EmpId, LeaveType, StartingFrom, EndingTo,RejoiningDate The On_Vacation table stores the information of employees who are on leave. I'm trying to query the table in such a way that my query
I have the following mysql table: Here in this table there could be houndred of thousands of rows, in which some may be with the same fir_sno [column No. 2]. My problem is that to select only the distinct rows from this table order by sno desc order.
Got stuck on this one, know it should be simple. But I have a list of unique IDs that looks like AB123456, XY584234, CDE987654. The last six characters mean something, so I need to find all rows that have the same last six characters as another (subs
SELECT * FROM training.dbo.[PERSON] P LEFT JOIN training.dbo.PERSON_CAREER_HISTORY PC ON (P.PERSON_ID=PC.PERSON_ID) CROSS JOIN (SELECT DISTINCT PC2.POSITION training.dbo.PERSON_CAREER_HISTORY) PC2 WHERE PC.POSITION IS NULL the cross join part is not
Is there a function wich can convert a date in format like : 31/07/2014 to a format date like 2014-07-31 I want to do this because in my sql query when i put the date in the format with " / " it doesn't understand te format :/ I have this messag
I have a sales_cat table, and a user_cat table. sales_cat id_cat name user_cat id id_user id_cat I need to get all the sales_cat rows, joined with the user_cat table for a specific user, indicating if that user has or not the category. Example, for i
Given declare @text varchar(4) ='3677.98*' , @text2 varchar(4) ='1245367.98%' I want the output as follows: 3,677.98* and 1,245,367.98% I tried below: select convert(varchar,cast(3677.98 as money),1) --output as 3,677.98 If I try select convert(varch
Hi I have two tables Table A and Table B . Table A has 3 columns id ,Location & name Table B has 3 columns id , location & address I need to join these two tables . I know we can use the location table to join . But in Table A say for Eg location
I want to copy/update data from Table A to Table B. Table B has some more additional columns. I have tried the following options. 1) `REPLACE INTO `B` (SHOW FIELDS FROM 'A') SELECT * FROM `A 2) `REPLACE INTO `B` (SELECT `COLUMN_NAME` FROM `INFORMATIO
I would like to select rows based on specific column values and a unique id column in SQL The Table I have is as follows Acc_id | Name | Status | value ---------------------------------------- 101 | com | Active | 1 202 | net | Active | 2 202 | net |
How can I use Cloud SQL to create a database? When I use MySQL, I could easily run a sql script to create them on phpMyAdmin. I found a site that advertises that it's possible to run SQL files right on Google Cloud SQL. This is exactly what I want to
I'm having a bit of a problem with a MySQL query in my PHP. I'm assuming it's down to a simple syntax issue and am hoping somebody here can help me out. The query is: SELECT * FROM `Threads` INNER JOIN `Categories` WHERE `Threads`.`Category_ID` = `Ca
//here is my function block public function create_accnt() { $post = $this->input->post(); //gets all possible posts in array form echo "Post array: ";print_r($post); // just to make sure that my array has values $data = array( 'userid' =&
I'm currently taking the online standford class on databases, If you could help me solve this sql problem I would greatly appreciate it. Sorry I'm a complete noob. Table Movie: mID | title | year | director Table Rating rID | mID | stars | ratingDate
How to take the time from date stored as 12/25/2012 5:12:05 AM . date('l F j, Y, g:i a',strtotime($last_login_details[FL_DATETIME])); This above function returned time as 12:00 am which should return 5:12AM. FL_DATETIME has datatype DATE. On database
I have two tables empmaster and allocation. I used union to do sql operation in order to get results from two tables. empmaster has empid and other empdetails. Table allocation contains empid from empmaster as foriegn key another field called per_all
I have a query such as: SELECT *, (A+B) AS TOTALVALUE FROM (SELECT A,B FROM MYTABLE) AS MYTABLE1 How can I use a case...when with the calculated value? For example, if my calculated value is greater than 1 I want it to be 10, otherwise I want it to r
So, I once again seem to have an issue with MS Access being finicky, although it seems to also be an issue when trying similar queries in SSMS (SQL Server Management Studio). I have a collection of tables, loosely defined as follows: table widget_mfg
I am trying to get the hierarchy level of this query. Here is the CTE recursive query WITH CategoryRec AS ( SELECT Id, Parentid, Name FROM dbo.Category UNION ALL SELECT cr.Id, c.Parentid, cr.Name FROM CategoryRec AS cr INNER JOIN dbo.Category AS c ON
I am creating a web page where user can select datasource and execute select statements and see the paginated results in table. Now for pagination i am wrapping queries to get total row count and rownum to fetch a particular block of rows. As we add
On Exeuting Following Query: SELECT ID FROM INSTITUTE WHERE MEMBER_ID IN ( SELECT ID FROM MEMBER WHERE ID IN (765,769,753,774,778,779,781,790,799,809, 820,823,855,835,839,842,845,849,850,851) ORDER BY NAME ASC ) I am getting following error: ORA-0090
I have the next task. Let's assume that we have below tables in a DB Vendor =========== Id Name ..... Product =========== Id VendorId Name ..... I need to be able to Sync main DB server with client DB server (one way sync), but there should be a poss
I have a mysql fields like this: url_id time_spent ------- ---------- 120 14 120 97 120 14 120 97 I want to display only 14 and 97 based on url_id(DISTINCT). select * from table group by url_id,time_spent
First select query Table 1: ID Value 131 ABC 120 DEF Second select query Table 2: ID 120 131 I want to write a single query which will fetch me combining two tables (the required output) ID Value 120 DEF 131 ABC Note: if there is no entry in Table2,
I need to use an Entity framework with my application, and I have used table - partitions in Oracle database. With simple JDBC, I am able to select data from a specific partition. But I don't know whether I can do the same with hibernate or Eclipse l
I using this in Access 2003. Pardon me if this is in the wrong spot, but I hoped someone could help. I have a table with multiple records that have a text represented date field. The date is in a format like: "06/01/2009" I need to select all th
I'm having trouble coming up with the proper syntax for allowing either a string or a NULL to be passed to the database. Here's my code: string insertString = String.Format( @"INSERT INTO upload_history (field1, field2, field3) VALUES ('{0}', '{1}',