[Solved] SQL Query for stats on table (Help in SQL query) [closed]

Below query should do the job. Names in the ADDED_BY column seem to be the reference for aggregation in both your columns. SELECT A.ADDED_BY, A.TOTAL_RECORDS_ADDED_BY, COUNT(B.UPDATED_BY) AS TOTAL_RECORDS_UPDATED_BY FROM (SELECT ADDED_BY, COUNT(*) AS TOTAL_RECORDS_ADDED_BY FROM YOUR_TABLE GROUP BY ADDED_BY) A LEFT JOIN YOUR_TABLE B ON A.ADDED_BY = B.UPDATED_BY GROUP BY A.ADDED_BY, A.TOTAL_RECORDS_ADDED_BY; solved SQL Query … Read more

[Solved] How to remove first letter if it is number in sql?

You could use the RIGHT() part of the string filtering wher the firts is a number eg: SELECT right(my_column, LENGTH(my_column)-1) FROM my_table WHERE my_column REGEXP ‘^[0-9]’ for update (remove the number ) you could use Update my_table set my_column= right(my_column, LENGTH(my_column)-1) WHERE my_column REGEXP ‘^[0-9]’ 1 solved How to remove first letter if it is … Read more

[Solved] String or binary data would be truncated when using it in a stored procedure

You are trying to insert 5 length character(‘dfdfg’) into your 1 length column [Access] [nvarchar](1). Increase the value of your column in Table type. CREATE TYPE [dbo].[AccessLevel] AS TABLE( [RoleId] [int] NULL, [Access] [nvarchar](25) NULL, [IsDelete] [bit] NULL ) GO solved String or binary data would be truncated when using it in a stored procedure

[Solved] Oracle : YEAR Keyword invalid

Oracle doesn’t have a year() function. You seem to have got that syntax from a different database (like MySQL). You can use the extract() function instead: select * from MIS_PERMAL.MV_INDEX_PERFORMANCE where index_id = 1045 and EXTRACT(YEAR from PRICE_DATE) = 2014 1 solved Oracle : YEAR Keyword invalid

[Solved] SQL Query – Need some assistance with a query [closed]

One way of doing this is to filter your select by using a subselect in the where clause. I did this really fast just to demonstrate: select * from manufacturer m inner join manufacturer_has_product mhp on m.manufacturer_id = m.manufacturer_id inner join product p on mhp.product_id = p.product_id where m.manufacturer_id in ( select m.manufacturer_id from manufacturer … Read more

[Solved] have multiple columns need to display column type with other column in rows

Your data does not match your desired results. Here is what I believe you want: create table deleteme_tbl(department int, title varchar2(20), mydate date); insert into deleteme_tbl values( 1,’One’, date ‘2016-01-01′); insert into deleteme_tbl values( 1,’Two’, date ‘2016-04-01′); insert into deleteme_tbl values( 1,’three’, date ‘2016-02-02′); insert into deleteme_tbl values( 2,’five’, date ‘2016-04-04’); insert into deleteme_tbl values( … Read more