简体   繁体   English

有没有办法从表中选择所有字段数据,除了使用nodejs的一个字段数据

[英]is there any way to select all the fields data from the table except one field data using nodejs

I want to fetch all the fields data but don't want to specify the fields name and don't want to create a view.我想获取所有字段数据但不想指定字段名称并且不想创建视图。 I have tried我努力了

WITH orderschema as 
(SELECT array_to_string(ARRAY(SELECT c.column_name
        FROM information_schema.columns As c
            WHERE table_name = 'orders' 
            AND c.column_name NOT IN('Quantity')
    ), ','))
    SELECT * from orderschema

but this is returning the schema fields name as a single string and i can't use this single string to get all the fields from the orders table.但这会将架构字段名称作为单个字符串返回,我不能使用这个单个字符串从订单表中获取所有字段。 is there any way to exclude the field directly in psql?有没有办法直接在psql中排除该字段?

Generally speaking no such way exists.一般来说,这种方式是不存在的。

But - if you plan on converting data to JSON in Pg (which you shouldn't for performance reasons, but you might if you really, really want to), you could just delete the column from json.但是- 如果您计划在 Pg 中将数据转换为 JSON(出于性能原因,您不应该这样做,但如果您真的非常想这样做),您可以从 json.xml 中删除该列。

The best way, though, is to write query that lists only the columns you need.不过,最好的方法是编写只列出您需要的列的查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法在表的一个字段中插入多个数据,并且一个特定数据在其字段上具有不同的值? 代码点火器 - Is there any way to insert multiple data in a field of table and one specific data has different value on its field? Codeigniter 使用jQuery从表格的文本字段中选择数据 - Select data from text fields in table using jQuery 选择所有文本框,但只有一个使用javascript - select all textboxes except one using javascript 使用javascript从2个选择字段计算到输入字段的数据 - Calculate data to an input field from 2 select fields with javascript 清空除一个字段外的所有字段 - Empty all fields except one 如何使用表中的全选复选框获取所有数据? - how to get all data using select all checkbox in table? 从html表中获取所有文本字段数据 - get All the text fields data from the html table 有没有办法通过使用僧侣来简化内容(从 mongodb 数据中检索到的列之一)? - Is there any way to simplify the content (one of the column retrieved from the mongodb data) by using monk? 使用nodejs和MySQL从数据库检索数据的正确方法是什么? - What is the correct way to retrieve data from database using nodejs and MySQL? 如何使用 NodeJs 从 postgres 返回 INSERT 命令中的所有数据 - How to return all the data in INSERT command from postgres using NodeJs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM